mysql_正则匹配中文(Mysql_ regular matches Chinese)
mysql_正则匹配中文(Mysql_ regular matches Chinese)
MySQL regular matching Chinese
With MySQL in HEX, the field is converted to 2, and then the regular matches the corresponding Chinese code code.
Our field stores utf8, so we query the utf8 Chinese character encoding table (if you are GBK, check the corresponding code control)
Chinese characters e[4-9][0-9a-f]{4}
Number (3[0-9])
The letter (4[0-9A-F]|5[0-9A]|6[0-9A-F]|7[0-9A]) corresponds to the code
Regular can be written as:
HEX (name) REGEXP'[[: <:>:]]'
Not \<: tetralogy of fallot:>: "MySQL is a regular stop / start.
REG_EXP_DATE = ^ (
([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3}) -
(
((0[13578]|1[02]) - (0[1-9]|[12][0-9]|3[01])) | ((0[469]|11) - (0[1-9]|[12][0-9]|30) | (02-) (0[1-9]|[1][0-9]|2[0-8]))
| (()) ([0-9]{2}) (0[48]|[2468][048]|[13579][26]) | ((0[48]|[2468][048]|[3579][26]) 00)) -02-29) \\s+ ([0-1])? [0-9]|2[0-3]) - ([0-5][0-9]) - ([0-5][0-9]) ";
Corresponding database YYYY-MM-DD HH24-MI-SS
(0[13578]|1[02]) | (0[469]|11) |02
Special characters in regular expressions
Characters /
Significance: for characters, they usually indicate literal meaning and indicate that the next character is a special character, without explanation.
For example, /b/ matches the character 'B' by adding a backslash in front of B, that is, /b/, which turns into a special character
A line that matches a word.
Or:
For several characters, the instructions are special, pointing out that the characters that follow are not special, but should be interpreted literally.
For example: * is a special character that matches any character (including 0 characters); for example, /a*/ means matching 0 or more a. To match the literal *, add a backslash to the front of the A; for example, /a*/ matches' a*'.
Characters ^
Significance: the characters that represent the match must be in the front.
For example: /^A/ mismatch \ \ an, A, \ \ in 'A', but match