The regex in question is:
(edit[\s\S]{0,}?service ("ALL")[\s\S]{0,}?next)
In the following example, my regex is working properly and it finds me all matches correctly from this:
edit 1035 set schedule "always" set service "ALL" set utm-status enablenextedit 103 set schedule "always" set service "ALL" set utm-status enablenext
See: https://regex101.com/r/A5E8Iu/1/
However, if I change the first occurrence of ALL
for ALL2
:
edit 1035 set schedule "always" set service "ALL2" set utm-status enablenextedit 103 set schedule "always" set service "ALL" set utm-status enablenext
See: https://regex101.com/r/A5E8Iu/2
it becomes greedy and includes the first match instead of only including the second one
Can someone explain me why it does not start at "edit 103" in the following updated example?