Mega Code Archive

 
Categories / MySQL Tutorial / Regular Expressions
 

Characters and classes used by the REGEXP and NOT REGEXP operators (or RLIKE and NOT RLIKE, which are synonyms)

'.' matches any single character. A character class '[...]' matches any character within the brackets. For example, '[abc]' matches 'a', 'b', or 'c'. To name a range of characters, use a dash. '[a-z]' matches any letter, whereas '[0-9]' matches any digit. '*' matches zero or more instances of the thing preceding it. For example, 'x*' matches any number of 'x' characters. '[0-9]*' matches any number of digits. '.*' matches any number of anything. A REGEXP pattern match succeeds if the pattern matches anywhere in the value being tested. A LIKE pattern match succeeds only if the pattern matches the entire value. '^' matches the beginning of the pattern. '$' matches the end of the pattern.