http://www.perlmonks.org?node_id=1044664


in reply to Quick Regex trouble

kennethk++ is right. I'd just like to post a word of warning concerning this part of your regex:

[[:alnum:]\.-:]+

Firstly, you don't need to escape the dot in a character class (but there's nothing stopping you from doing so...). More importantly, the sequence

\.-:

(with or without the backslash) in a character class means "any character between '.' (dot) and ':' (colon) (inclusive)".

As it happens, the only things in the ASCII (or UTF, or whatever) table between these two characters are the forward slash and the digits 0-9 (the latter being included, of course, in [:alnum:]).

The point is, that if you want to put a literal hyphen in a character class, you should generally put it at the very beginning or the very end, or else escape it with a backslash.

Update: Typos (yawn)