Find telephonenumbers - finding number with and without an phone extension

Posted by nWorx on Stack Overflow See other posts from Stack Overflow or by nWorx
Published on 2010-05-04T13:17:19Z Indexed on 2010/05/04 13:28 UTC
Read the original article Hit count: 206

Filed under:
|
|
|

Hello there

I've a table with about 130 000 records with telephonenumbers. The numbers are all formated like this +4311234567. The numbers always include international country code, local area code and then the phonenumber and sometimes an extension.

There is a webservice which checks for the caller's number in the table. That service works already. But now the client wants that also if someone calls from a company which number is already in the database but not his extension, that the service will return some result.

Example for table.

   **id** | **telephonenumber**    | **name**   
|    1    | +431234567             | company A  
|    2    | +431234567890          |  employee in company A  
|    3    | +4398765432            | company b 

now if somebody from company A calls with a different extension for example +43123456777, than it should return id1. But the problem is, that I don't know how many digits the extensions have. It could have 3,4 or more digits.

Are there any patterns for string kind of matchings?

The data is stored in a sql2005 database.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about telephone