in reply to Re^2: Regular expressions
in thread Regular expressions
As I said, the ?: makes it so the group within the () is not captured. Observe...
Without ?::
perl -E '"123" =~ /(2|3)/; say $1' 2
With ?::
perl -E '"123" =~ /(?:2|3)/; say $1'
Note how using the ?: doesn't put anything into the special numbered $1 variable. See perlretut's Non-Capturing Groupings
|
|---|