简体   繁体   English

获取仅包含少于4位数字的行

[英]Get rows that contain less than 4 digits only

I need to fetch the rows that contain less than 4 consecutive digits. 我需要获取少于4个连续数字的行。 I tried using this : 我尝试使用这个:

select mycolumn where mycolumn REGEXP '[0-9]{1,3}' 

but this still returned rows such as "Test Text 1234-1234" I need to return these only: 但这仍返回诸如"Test Text 1234-1234"行,我只需要返回这些行:

Test 12
Test 234 Text
Test /2 Text
text 123 text 1234 text

Thanks to @BenM and @lad2025, the correct answer is: 感谢@BenM和@ lad2025,正确的答案是:

'[[:<:]][0-9]{1,3}[[:>:]]'

http://sqlfiddle.com/#!9/af95e/3/0 http://sqlfiddle.com/#!9/af95e/3/0

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

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