Using the string form of eval() will do runtime compilation of the regex and therefore not break the program if it is invalid. Also note the abbreviation of 'regular expression' is commonly known as regex (and it's a lot easier to pronounce too ;-)my $format = "foo (bar] baz"; eval '$regex = qr/$format/;'; die "ack - $@" if $@; __output__ ack - Unmatched ( before HERE mark in regex m/foo ( << HERE bar] baz/ +at (eval 1) line 1.
_________
broquaint
In reply to Re: How to identify invalid reg. expr.?
by broquaint
in thread How to identify invalid reg. expr.?
by armyk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |