Searching for phone numbers in mysql

后端 未结 16 2335
耶瑟儿~
耶瑟儿~ 2020-12-30 06:40

I have a table which is full of arbitrarily formatted phone numbers, like this

027 123 5644
021 393-5593
(07) 123 456
042123456

I need to sea

16条回答
  •  伪装坚强ぢ
    2020-12-30 06:54

    See

    http://www.mfs-erp.org/community/blog/find-phone-number-in-database-format-independent

    It is not really an issue that the regular expression would become visually appalling, since only mysql "sees" it. Note that instead of '+' (cfr. post with [\D] from the OP) you should use '*' in the regular expression.

    Some users are concerned about performance (non-indexed search), but in a table with 100000 customers, this query, when issued from a user interface returns immediately, without noticeable delay.

提交回复
热议问题