in reply to Help with Regular Expression matching
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];
|
|---|