I'm trying to find a regular expression to replace this idea:
if($input === numbers_only($phone_number)) {
// do something
}
Assumptions
$input will always be numeric
numbers_only() strips all non-numeric characters
Context
At the end of the day I need to write a MySQL query that does this against a column formatted as TEXT which is why I can't simply use a function like the above. So it'd look something like:
SELECT
number
FROM
phones
WHERE
number REGEXP '...'
Is this something regex can handle?
Update
I think a better way to phrase this question (or another way to come at it) may be if there's a way the CONVERT() method in MySQL can handle converting TEXT (not varchar) to INT for a comparison.