and/pat1/ && /pat2/
aren't equivalent in the first place./(?=.*?pat1)(?=.*?pat2)/s
Note also that the OP didn't specify whether pat1 and pat2 may overlap. /pat1/ && /pat2/ has the potential to match more than /pat1.*pat2|pat2.*pat1/s. All of the presented solutions so far assume it's ok the patterns may overlap.
In reply to Re^4: AND and OR on Regular Expressions
by JavaFan
in thread AND and OR on Regular Expressions
by vitoco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |