In Perl regexps, "\w" matches any "word character": alphanumerics (according to the locale) and underscores. Note that it does not match a whole "word"; just a character of a "word". Also note that English language words do not usually include digits or underscores; these are really the characters legal from the second position in C-style identifiers.

"\W" (which unfortunately shares this node) matches any "non-word character" -- the complement of the set matched by "\w". Thus, it is just "[^\w]".

Log in or register to write something here or to contact authors.