in reply to Using OR () in Regex
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!" }
|
|---|