Answer the question
In order to leave comments, you need to log in
How to search by phone number?
The phone number in the database is stored in the format: +7(111)111-11-11
How can we implement a search for this number if we have such a +7(111)111-1111, or such a number: +71111111111 ? Preferably using regular expressions in SQL query
Answer the question
In order to leave comments, you need to log in
Regular expressions give a large overhead (excessive cost) with each search.
Why do you need this?
When saving to the database, bring the phone number to a single format (regular expressions are also possible), and then look for it without any problems.
I will support Vladimir, when entering into the database, always bring the number to one format, when searching, first with regular expressions, bring it to the desired format, and only then a simple sql search query.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question