简体   繁体   English

正则表达式到MySQL

[英]Regexp to mysql

Need to construct regexp to this 需要为此构建正则表达式

2 1231 21231 2312 2123 22 2 2 1231 21231 2312 2123 22 2

Need to find only 2, not 1231, not 21231, only 2 只需要找到2,而不是1231,不是21231,只有2

So, my regexp is 所以,我的正则表达式是

^[[:digit:]]?{1}[2]{1}^[[:digit:]]?

Is it right ? 这样对吗 ?

Sorry if my ask like a 'do it for me', but i really cannot into regexp. 抱歉,我的询问是否喜欢“为我做”,但是我真的不能进入正则表达式。

UPD UPD
input string 2 22 1312 123123 22312 21 2 输入字符串2 22 1312 123123 22312 21 2
need to match "2" 需要匹配“ 2”
2 22 1312 123123 22312 21 2 2 22 1312 123123 22312 21 2
with or w\\o digits after\\before 在\\之前或之后

Sounds simple enough... 听起来很简单...

/\b2\b/g

How about this one? 这个怎么样? Example

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

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