简体   繁体   English

如何在MySQL中使用正则表达式?

[英]How to use regex in MySQL?

I want to filter out those with field not like '%_[0-9]+' , 我想过滤那些field not like '%_[0-9]+'

but it turns out that MySQL doesn't take it as regex, 但事实证明MySQL并不把它当作正则表达式,

is that possible in MySQL? 在MySQL可能吗?

That happens because of LIKE is not supposed to accept regular expression as a parameter. 这是因为LIKE不应该接受正则表达式作为参数。 There is REGEXP for such things 对于这样的事情有REGEXP

WHERE field NOT REGEXP '%_[0-9]+'

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

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