Please note that /(PAT1.*PAT2)|(PAT2.*PAT1)/ and /PAT1/ and /PAT2/ are not equivalent. The latter will match if PAT1 and PAT2 can overlap, while the former will only match non-overlapping patterns. For instance,
$_ = "foof";
/(foo.*oof)|(oof.*foo)/;
doesn't match, but
$_ = "foof";
/foo/ and /oof/
does.
Note also that using multiple regexes cannot always be done. Think functions taking regexes are argument (split!), or patterns stored in configuration files. |