or use (?(condition)...), taken almost literally from perlre:my ($match) = grep defined, $string =~ /<(ab)>|(ab)/;
my ($quoted,$match) = $string =~ /(<)?(ab)(?(1)>)/x; # or: my $match = ($string =~ /(<)?(ab)(?(1)>)/)[1];
In reply to Re: Help with Regular Expression matching
by ysth
in thread Help with Regular Expression matching
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |