Regular expression matching E.164 formatted phone numbers

后端 未结 7 1734
栀梦
栀梦 2020-12-23 16:14

I need to add a regular expression that matches all possible valid E.164 formatted phone numbers.

This regex works fine for for North American phone numbers, but I

7条回答
  •  -上瘾入骨i
    2020-12-23 17:04

    The regex you've provided should work except that the initial + needs to be escaped.

    /^(\+1|1)?[2-9]\d\d[2-9]\d{6}$/g
    

    See it working at http://refiddle.com/19x

提交回复
热议问题