Regular expression matching E.164 formatted phone numbers

后端 未结 7 1746
栀梦
栀梦 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 16:56

    This matches only formats like +16174552211 and 16174552211

    /\A\+?\d{11}\z/
    

    It is especially useful if you are using Twilio and Ruby on Rails

提交回复
热议问题