Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mysql中的文本匹配需要正则表达式_Mysql_Regex_Qregexp - Fatal编程技术网

mysql中的文本匹配需要正则表达式

mysql中的文本匹配需要正则表达式,mysql,regex,qregexp,Mysql,Regex,Qregexp,您好,我需要一个正则表达式每个我的sql查询匹配到文本 "SIP/(10 NUMBERS)" 相等于 "SIP/1234567890" “SIP”是文本 和10个随机数0-9 更新 最终文本为SIP/0123456789-000001cc 在哪里 "SIP/" is text "0123456789" Always 10 digits "-" is character "000001cc" is random alphanumeric 使用\转义/ 以下正则表达式以SIP为目标,

您好,我需要一个正则表达式每个我的sql查询匹配到文本

"SIP/(10 NUMBERS)"
相等于

"SIP/1234567890"
“SIP”是文本 和10个随机数0-9

更新

最终文本为SIP/0123456789-000001cc

在哪里

"SIP/" is text

"0123456789" Always 10 digits 

"-" is character 

"000001cc" is random alphanumeric

使用
\
转义
/

以下正则表达式以SIP为目标,后跟
/
,然后是10位字符:

SIP\/\d{10}

您可以使用此正则表达式:

^SIP/[[:digit:]]{10}-
示例:

mysql> select 'SIP/0123456789-000001cc' regexp '^SIP/[[:digit:]]{10}-';
+----------------------------------------------------------+
| 'SIP/0123456789-000001cc' regexp '^SIP/[[:digit:]]{10}-' |
+----------------------------------------------------------+
|                                                        1 |
+----------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select 'SIP/123456789-000001cc' regexp '^SIP/[[:digit:]]{10}-';
+----------------------------------------------------------+
| 'SIP/123456789-000001cc' regexp '^SIP/[[:digit:]]{10}-' |
+----------------------------------------------------------+
|                                                        0 |
+----------------------------------------------------------+
1 row in set (0.00 sec)

您好,感谢回复其工作,请我更新我的问题每新闻指令可以帮助我吗?