Stella architect curly bracket4/2/2024 ![]() 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.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |