Does MySQL have a wilcard number?

I want to select headers that have a number after a specific character. Example:

SELECT * FROM table WHERE title LIKE '%- H(any number)' 

How can I select any number in this expression 1-10000000 if the number exists?

+4
source share
3 answers
 SELECT * FROM table WHERE title REGEXP '.*- H[0-9]+' 

This is similar to what you are looking for.

+4
source
 SELECT * FROM table WHERE title RLIKE '- H[:digit:]{1,7}$'; 

will provide you 1-9999999

+2
source

Use regex :

 SELECT ... FROM table WHERE title REGEXP '- H([1-9][0-9]{0,6}|10000000)$' ; 
0
source

Source: https://habr.com/ru/post/1391563/


All Articles