SQL Regex last character search not working

后端 未结 2 2024
野的像风
野的像风 2021-01-23 15:19

I\'m using regex to find specific search but the last separator getting ignore.

Must search for |49213[A-Z]| but searches for |49213[A-Z]

SELECT * FROM t         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-23 16:03

    Why are you using | in the pattern? Why the +?

    SELECT * FROM table WHERE (data REGEXP '\|49213[A-Z]\|')
    

    If you want multiple:

    SELECT * FROM table WHERE (data REGEXP '\|49213[A-Z]+\|')
    

    or:

    SELECT * FROM table WHERE (data REGEXP '[|]49213[A-Z][|]')
    

提交回复
热议问题