- SQL pattern matching enables you to use “_” to match any single character and “%” to match an arbitrary number of characters (including zero characters).
- In MySQL, SQL patterns are case-insensitive by default.
- You do not use = or <> when you use SQL patterns; use the LIKE or NOT LIKE comparison operators instead.
- The other type of pattern matching provided by MySQL uses extended regular expressions. When you test for a match for this type of pattern, use the REGEXP and NOT REGEXP operators (or RLIKE and NOT RLIKE, which are synonyms).
- some characteristics of extended regular expressions:
- “.” matches any single character.
- “*” matches zero or more instances of the thing preceding it.
- A REGEXP pattern match succeeds if the pattern matches anywhere in the value being tested. (This differs from a LIKE pattern match, which succeeds only if the pattern matches the entire value.)
- To anchor a pattern so that it must match the beginning or end of the value being tested, use “^” at the beginning or “$” at the end of the pattern.
mysql pattern matching
最新推荐文章于 2023-11-09 19:28:40 发布