Update: I used a form which was needless complicated in this particular instance. I struke the related content, even though it's not technically wrong. In exchange, I added the new form. The new content is enclosed by bold parens.
Things to know:
/$re1/ && /$re2/
(?:(?!$re).)
Keep in mind
can be written as
/^(?=.*$re1)(?=.*$re2)/s
or as
/^(?=.*$re1).*$re2/s
is to regexps as
[^$chars]
is to characters.
'abc' =~ /[^a]/s matches at pos 1
'abc' =~ /^[^a]*$/s does not match
'abc' =~ /(?:(?!ab).)/s matches at pos 1
'abc' =~ /^(?:(?!ab).)*$/s does not match
(
Similarly
!/$re1/s && /$re2/s
can be written as
/^(?!.*$re1)(?=.*$re2)/s
or as
/^(?!.*$re1).*$re2/s
)
Any of the following do what you want
In reply to Re: Negative Lookahead Assertion Strangness
by ikegami
in thread Negative Lookahead Assertion Strangness
by sas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |