Search code examples
ruby-on-railsregexvonage

RegEx matching phone number beginning by 33


I am currently developping an app where I need to send an SMS when the customer complete the order.

I use Nexmo so the phone number has to be under the format 33670851001 (beginning with 33 and followed by 9 numbers).

Would you have an idea on how to do it? RegEx have always been really hard for me to get.


Solution

  • the regexp for a number that starts with 33 followed by 9 numbers is as follows: /^33\d{9}$/