Thursday 5 December 2019

Get only digits using regexp

https://stackoverflow.com/questions/16922248/get-only-digits-using-regexp/16922465


I have in table column pnum_s
I need get only that rows, which value in column pnum_s is exactly 10 symbol and all these symbols are only digits
what query must write for this?
I am trying
SELECT * FROM mytable WHERE pnum_s REGEXP '^\d+$'



The pattern you are looking for is either '^[0-9]{10}$' or '^[[:digit:]]{10}$'.
Everything is in the manual.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive