简体   繁体   English

用REGEXP查找模式mysql的特定格式

[英]find a specific format of pattern mysql with REGEXP

dears 亲爱的

i want to match all records with this formula XXX:XXXXX where X any number from 0-9 我想将所有记录与该公式XXX:XXXXX匹配,其中X可以是0-9之间的任何数字

ie 123:12312 333:09102 etc 即123:12312 333:09102等

i tried: 我试过了:

select * from table where field REGEXP '^*[0-9][0-9][0-9]:[0-9][0-9][0-9][0-9][0-9]*$'

but it doesn't work 但这不起作用

This will be work to check the REGEXP 这将用于检查REGEXP

SELECT 
  '123:12345'  REGEXP '^[0-9]\{3\}:[0-9]\{5\}$',
  '123:123456' REGEXP '^[0-9]\{3\}:[0-9]\{5\}$',
  '123:A2345'  REGEXP '^[0-9]\{3\}:[0-9]\{5\}$',
  'A23:12345' REGEXP '^[0-9]\{3\}:[0-9]\{5\}$',
  '123:12345' REGEXP '^[0-9]\{3\}:[0-9]\{5\}$';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM