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