Whitespace Metacharacters

Metacharacter Description


Form feed


Line feed


Carriage return




Vertical tab

Matching \

To Match \ To match the backslash character itself (\), you would need to use \\\.

\ or \\? Most regular expression implementation use a single backslash to escape special characters to be able to use them as literals. MySQL, however, requires two backslashes (MySQL itself interprets one and the regular expression library interprets the other).

Matching Character Classes

There are matches that you'll find yourself using frequently, digits, or all alphabetical characters, or all alphanumerical characters, and so on. To make working with these easier, you may use predefined character sets known as character classes. Following table lists the character classes and what they mean.

Character Classes

Class Description


Any letter or digit, (same as [a-zA-Z0-9])


Any letter (same as [a-zA-Z])


Space or tab (same as [\\t ])


ASCII control characters (ASCII 0 through 31 and 127)


Any digit (same as [0-9])


Same as [:print:] but excludes space


Any lowercase letter (same as [a-z])


Any printable character


Any character that is neither in [:alnum:] nor [:cntrl:]


Any whitespace character including the space (same as [\\f\\n\\r\\t\\v ])


Any uppercase letter (same as [A-Z])


Any hexadecimal digit (same as [a-fA-F0-9])