Mega Code Archive

 
Categories / Perl / Regular Expression
 

Using Special-Meaning Characters

\d matches any digit from zero to nine. Its equivalent is [0-9]. \D matches anything but from zero to nine. Its equivalent is [^0-9]. \s matches any white space character (tab, form feed, carriage return, space, and newline characters). \S matches any character but a white space character. \w matches any alphanumeric character, including the underscore. Its equivalent is [a-zA-Z0-9_]. \W matches any character but an alphanumeric character, including the underscore. Its equivalent is [^a-zA-Z0-9_]. \b matches on the word boundary.  \B matches not on a word boundary. \oNN matches octal numbers. \xNN matches hexadecimal numbers. \cC matches control characters.