Norse
Norse

Reputation: 5757

REGEX Match integers 6 through 10

I want to find integers any integers between 6 and 10. I've tried:

[6-10]{1,2}

but this throws a mysql error (this is for a mysql query). How do you match numbers between 6 and 10?

Upvotes: 9

Views: 615

Answers (1)

John Woo
John Woo

Reputation: 263703

why complicate your syntax? couldn't it be as simple as this? Using BETWEEN,

SELECT...
FROM..
WHERE columnName BETWEEN 6 AND 10

but anyway if you have other use, you can use REGEXP in MySQL

where columName REGEXP '10|[6-9]'

SQLFiddle Demo

Upvotes: 26

Related Questions