perl_mystery has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Regex for matching a word followed by digits plus :
by ikegami (Patriarch) on Feb 20, 2011 at 06:15 UTC
    It fails to match because the pattern isn't found in those strings. If "OUTPUT" indicates the output you desire, the pattern should be
    /-\s(\w+)[.0-9]*\s:/
    or just
    /-\s(\w+)/
      /-\b(\S+)\b\s:/ ?
        That would not produce the provided output.
Re: Regex for matching a word followed by digits plus :
by Anonymous Monk on Feb 20, 2011 at 06:13 UTC
    well, for starters, its not matching a word followed by digit plus

    Also, how is this different from the problem from december?

Re: Regex for matching a word followed by digits plus :
by JavaFan (Canon) on Feb 20, 2011 at 11:35 UTC
    I find it really hard to believe that's the output you're getting giving the stated input and regexp. Considering each line has just a single colon, I expect the output to be:
    3_ 0
    If the output given is the wished output, then the answer is: there's more than just a digit and a whitespace character between your "word" and the colon. In the first line, there's ".00.00.3_3 ", the second line has ".00.04.00 ". None of them are completely matched by /[0-9]\s/. They are matched by /\.[0-9]{2}\.[0-9]{2}\.(?:[0-9]_[0-9]|[0-9]{2})\s/, or a billion other patterns.