In MySQL, use the RegExp keyword to match the query regular expression, which has the following basic form:
Field name REGEXP ' Match method '
Pattern character meaning Use example
^ Match start SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' ^php ';
$ match End SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' php$ ';
. Match any one of the characters SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' P. ';
[CharSet] matches any one of the SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' [PCA] ' in the character set;
[^ charset] matches any character other than the character set SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' [^PCA] ';
s1| s2| S3 matches any one of the strings in SELECT ' books ' from ' Tb_name ' where ' books ' REGEXP ' php|c|html ';
* Match multiple characters before the symbol, including 0, 1 SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' p*a ';
+ Match multiple characters before the symbol, including 1 SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' P+a ';
string {n} match string appears N times SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' a{3} ';
string {m,n} match string appears m-n times SELECT ' books ' from ' Tb_name ' WHERE ' books ' REGEXP ' a{3,6} ';
MySQL Regular expression (pending update ...) )