The regular expression function is really powerful, the day dedicated to learning, here is temporarily used in MySQL query.
Regular expressions are powerful and flexible and can be applied to very complex queries.
Options |
Description (auto plus match word) |
Example |
Example of matching values |
^ |
Text Start character |
' ^b ' matches a string beginning with the letter B |
Book, big, banana, bike |
$ |
Text End character |
' st$ ' matches a string ending with St |
Test, resist, persist |
. |
Any single character |
' b.t ' matches any one character between B and t |
Bit, bat, but, bite |
* |
0 or more characters in front of it |
' F*n ' match character n preceded by any n characters F |
FN, fan, FAAN, ABCN |
+ |
The preceding character is one or more times |
The ' ba+ ' match starts with a b followed by at least one a |
BA, bay, Bare, battle |
< strings > |
Text containing the specified string |
' FA ' |
Fan, AFA, Faad |
[Character Set] |
Any of the characters in a character set |
' [XZ] ' matches x or Z |
Dizzy, Zebra, X-ray, extra |
[^] |
Any characters that are not in parentheses |
' [^ABC] ' matches any string that does not contain a, B, or C |
Desk, Fox, F8ke |
string {n} |
The preceding string is at least n times |
B{2} matches 2 or more B |
BBB, BBBB, BBBBBB |
string {n,m} |
The preceding string is at least n times, up to M times |
b{2,4} matches a minimum of 2, up to 4 b |
BB, BBB, BBBB |
where field name REGEXP mode;
Using regular expression queries in MySQL