.

MySQL Regular Expression : REGEXP '/d{3}' not working for 3 digit numbers

Problem:


Not getting any data using regular expression '/d{3}' to search for all values in myData having 3 digits only.




SELECT * FROM myTable WHERE myData REGEXP '/d{3}'


Solutions:

Use any out of these:


SELECT * FROM myTable WHERE myData  REGEXP '^[0-9]{3}$'

OR


SELECT * FROM myTable WHERE myData REGEXP '^[[:digit:]]{3}$'


Feel free to share your queries and doubts here in comments.

No comments :

Post a Comment

Recent Posts