I need tofind MATCH only if it is between START and STOP:
-
blah START hello MATCH bye STOP blah -
blah START hello MATCH STOP blah -
blah MATCH blah START hello MATCH STOP blah
e.g.: on line 3, only the 2nd MATCH should be found.
Please note that START, STOP and MATCH are not literals. They are expressed as parts regex of the regex.
Of course, a simplified but non elegant solution would consist in extracting the part between START and STOP and then looking for MATCH in there.
TIA,
Just capture whatever “MATCH” is. You may have additional criteria for the things that can occur between START – MATCH – STOP (as opposed to just “.”), if so, use a character class.