You could do the same with:if ( $string =~ m/abc(?:def|xyz)/ ) { print "ok!" }
but in this case the regexp would spit out in $1 'def' or 'xyz', which probably you don't want. Look at the Regexp Documentation for further details.if ( $string =~ m/abc(def|xyz)/ ) { # I didn't use ?: print "ok!" }
In reply to Re: Using OR () in Regex
by larsen
in thread Using OR () in Regex
by arunhorne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |