in reply to Re: substituting capture groups substrings
in thread substituting capture groups substrings

For future browsers: /d should be \d, and really, unless you intend to allow unicode digits, should probably be [0-9].

--MidLifeXis

Replies are listed 'Best First'.
Re^3: substituting capture groups substrings ( s///aa m//aa qr//aa)
by Anonymous Monk on Jul 14, 2015 at 23:43 UTC

     For future browsers: /d should be \d, and really, unless you intend to allow unicode digits, should probably be [0-9].

    Thats what //a and //aa are for (since v5.13.10 according to perlver)

    $ perl -Mre=debug -le "print qr/\d/" Compiling REx "\d" Final program: 1: DIGIT (2) 2: END (0) stclass DIGIT minlen 1 (?^:\d) Freeing REx: "\d" $ perl -Mre=debug -le "print qr/\d/u" Compiling REx "\d" Final program: 1: DIGIT (2) 2: END (0) stclass DIGIT minlen 1 (?^u:\d) Freeing REx: "\d" $ perl -Mre=debug -le "print qr/\d/a" Compiling REx "\d" Final program: 1: DIGITA (2) 2: END (0) stclass DIGITA minlen 1 (?^a:\d) Freeing REx: "\d" $ perl -Mre=debug -le "print qr/\d/aa" Compiling REx "\d" Final program: 1: DIGITA (2) 2: END (0) stclass DIGITA minlen 1 (?^aa:\d) Freeing REx: "\d"

      Only if you have the capability to run on perls newer than that. [0-9] works back much further.

      --MidLifeXis

        MidLifeXis: Only if you have the capability to run on perls newer than that. [0-9] works back much further.

        :) yeah I was thinking "I know something, FYI there is a new feature to disambiguate the magic of \d" but it came out as "thats what X is for"