I need to search in a database for a phonenumber.
However, I don't know how the phone number is stored in the database, this can be in different ways, like:
0123456789
012 3456789
012 34 56 78 9
012-3456789
The string that I have to look for is always formatted like
0123456789
My query now looks like:
SELECT * FROM account WHERE phonenumber = '0123456789'
But this ofcourse only works when the phonenumber is formatted like the search string.
How do I use a regex of other function to search for all kind of formatted phonenumbers?