i have project in ASP.NET MVC 3 and a mysql database that contains a table of string values for phone numbers (this phone numbers can be stored as 123 456-789 or 12345 6789 or 123456789 or any ways the user enter his number) and other table with a keywords data for that users.
The thing is that i have a search that will find in the keywords table (fulltext table) for the users, but i’m writing a method that search in the phone table if the search query matches against certain regular expression.
I have 2 questions:
– How could be that regular expression from the C# code side that tells what method to execute (SearchByKeyword or SearchByNumber)?
– Using the same regular expression i think, i must do the mysql query to search in the phones table… how can i do it?
I hope i have explained well and sorry if my english is a little bit bad.
It’s best when you capture the data to standardise the format it is saved in, IE:
All will save as
You can then do a simple LIKE query: