how to detect telephone numbers in a text (and replace them)?

后端 未结 4 461
名媛妹妹
名媛妹妹 2020-12-09 19:21

I know it can be done for bad words (checking an array of preset words) but how to detect telephone numbers in a long text? I\'m building a website in PHP for a client who n

4条回答
  •  死守一世寂寞
    2020-12-09 20:22

    To do so you must use regular expressions as you may know.

    I found this pattern that could be useful for your project:

       
    

    More information about this pattern can be found here http://gskinner.com/RegExr/?2rirv where you can even test it online. It's a great tool to test regular expressions.

提交回复
热议问题