in reply to Re: Regular expressions
in thread Regular expressions

this may be a stupid question, but what is the function of the :

Replies are listed 'Best First'.
Re^3: Regular expressions
by stevieb (Canon) on Oct 27, 2015 at 17:02 UTC

    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