Let's say I have this regex:
m/foo(.*?)foo/;
What I'm looking to express that I don't know how to is this:
how do I make it so that $1 may not contain the substring
"bar"?
I've looked into
both of which are
wrong because they either require the string to be at least
3 characters long, don't account for different posiitons
of bar within the string, or also disallow "rab" and "arb".
So I want to express minimal matching of any arbitrary
characters disallowing a certain subpattern. How can I do
this?
I've heard as a suggestion negative lookahead assertions, but
I was under the impression that they were only for matching
overlapping pieces of text, i.e. if you were matching:
"pop" against "popop" you would use a negative lookahead
assertion if you wanted more than one match to be returned.
(because the first p of the second "pop" overlaps with the
last p of the first match)
Any suggestions?