开发者

mysql regular expression

I found this query in mysql query log and I will like to know what exactly does it do.

select * from tblname WHERE TRIM(NAME) REGEXP 'John[      ]*S开发者_运维百科mith'


It selects all rows from tblname where name (with spaces around removed, if any) equals to John<any number of spaces>Smith

So you'll find JohnSmith as well as John_________________________Smith (stackoverflow eats repetitive spaces, so I replaced them with underscore).

The regex itself is a little bloated and can be rewritten as John *Smith

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜