in reply to Re: RegEx Headaches
in thread RegEx Headaches

... more complicated than necessary.

Since the decimal digit groups appear to be unambiguously delimited to begin with, no need to worry about a delimiter or capture group at all:

>perl -wMstrict -le "$_ = 'ActionLogs.1.22.333.'; ;; my @digit_groups = m{ \d+ }xmsg; printf qq{'$_' } for @digit_groups; " '1' '22' '333' '4' '5' '6' '7' '8' '987'

Replies are listed 'Best First'.
Re^3: RegEx Headaches
by kcott (Bishop) on Jun 22, 2013 at 22:30 UTC

    ++ Yes, that works and is less complicated still. :-)

    It wouldn't have occurred to me not to use a capture group. I checked the online docs and found in perlretut - Using regular expressions in Perl - Global matching (after following links from perlre):

    In list context, //g returns a list of matched groupings, or if there are no groupings, a list of matches to the whole regexp. [my emphasis]

    That seemed new to me (those links are for 5.16.2), so I checked back to the earliest online perldoc version (5.8.8) and, while in a different manpage ( with different wording, that behaviour was current back then:

    In list context, it returns a list of the substrings matched by any capturing parentheses in the regular expression. If there are no parentheses, it returns a list of all the matched strings, as if there were parentheses around the whole pattern. [my emphasis, again]

    I've learned something new. Thankyou.

    -- Ken