grep with regex for phone number

后端 未结 11 2119
盖世英雄少女心
盖世英雄少女心 2020-12-04 22:39

I would like to get the phone numbers from a file. I know the numbers have different forms, I can handle for a single one, but don\'t know how to get a uniform regex. For ex

11条回答
  •  离开以前
    2020-12-04 23:03

    My first thought is that you may find it easier to see if your candidate number matches against one of four regular expressions. That will be easier to develop/debug, especially as/when you have to handle additional formats in the future.

提交回复
热议问题