Mysql regular expression not there
The following does not match, as r falls outside of the range a-p. The square brackets also permit a range match, for example, to match any character from a-z, is used. For example, to match either the p or the r character: SELECT 'Maria' REGEXP 'Maia' groups characters for matching purposes. This notation is used to match many instances of the x. (xyz) - combine a sequence, for example (xyz)+ or (xyz)* SELECT 'Maria' REGEXP '(ari)+' In the examples below, it's the r character. X* matches zero or more of a character x. matches any single character: SELECT 'Maria' REGEXP 'Ma.ia' $ matches the end of a string: SELECT 'Maria' REGEXP 'ia$' ^ matches the beginning of a string (inside square brackets it can also mean NOT - see below): SELECT 'Maria' REGEXP '^Ma' It's the special characters that give regular expressions their power. The above examples introduce the syntax, but are not very useful on their own. For example: SELECT 'Maria' REGEXP 'Monty|Maria' When the order is reversed, the result is false, as the pattern "Maria" does not exist in the expression "Mari"Ī match can be performed against more than one word with the | character. The first returns true because the pattern "Mari" exists in the expression "Maria". Note that the word being matched must match the whole pattern: SELECT 'Maria' REGEXP 'Mari' The match is case-insensitive, except in the case of BINARY strings.
Without any special characters, a regular expression match is true if the characters match. Also note that until MariaDB 10.0.5, regular expressions were not multi-byte safe, and therefore could produce unexpected results in multi-byte character sets. Comparisons are performed on the byte value, so characters that are treated as equivalent by a collation, but do not have the same byte-value, such as accented characters, could evaluate as unequal.