in reply to Re^2: regular expressions. help
in thread regular expressions. help

The (\w+)$ is killing you again. You match 'HISTOGRAM OF', whitespace, asterisk, whitespace, but the rest of your string is not all \w (word chars), and since you added the '$' to match until the end, the \w+ fails to match when it hits whitespace again.

I cannot stress enough to regex learners that whitespace NEEDS to be treated like all other characters.

Replies are listed 'Best First'.
Re^4: regular expressions. help
by apocalyptica (Acolyte) on Jun 29, 2004 at 20:40 UTC
    Okay. So I could theoretically get rid of the $ so that it doesn't match until the end, then? Or what would be the best way to get around this?

    Thanks for your help, by the way. This is leaving me more than a bit frazzled.