[Israel.pm] run many regexes

David Baird davidlbaird at gmail.com
Sat May 3 13:31:53 EEST 2008


I think the correct expression is qr//o. The 'o' option tells Perl to
compile the regex once. It is documented in perlop.

Shmuel, they are not run with qr//o, they are compiled. If the regex
is in a loop, for example, they are not compiled for each iteration of
the loop. The only caveat is if you place a variable in your regex,
which will be compiled once, and if that variable changes, the changes
will not be reflected each time the regex is used.

> So, all the regexes are executed before you have a chance to decide
> pass/fail.
> Isn't it better to run them one by one and break if one of them fails?
>
> Shmuel.


More information about the Perl mailing list