in reply to hyphen in regular expression

A hyphen in a character class [a-d] (and please use <code> ... </code> or <c> ... </c> tags around anything that looks like it might be code, e.g., anything in square brackets) specifies a range of characters; [a-d] is equivalent to [abcd], so you need to use exactly what you used in your original post!

Note that \w is very close to what you want, except it also includes the underscore character '_' and is affected by locale.

See: perlre, perlretut, perlrequick.

Replies are listed 'Best First'.
Re^2: hyphen in regular expression
by ikegami (Patriarch) on Sep 18, 2008 at 15:49 UTC
    It's only affected by locale if use locale; is in effect.