Phone validation REGEX for Twilio -


i trying create regular expression force users enter phone numbers of format accepted twilio api. prefix of form +40 (eg.: +40123456789) not 0040 , without delimiters. character + , numbers.

i came far \+\d{10,}.

is one? if not can please improve on it?

thanks.

edit:

  • the phone number should contain prefix of country , phone number
  • the prefix not fixed +40(romanian prefix). example.
  • the prefix should start + not 00
  • the number should not have delimiters

good example: +40123456789 bad example: (074) 352-7819

the pattern provided expect match plus sign followed 10 digits. if string starts letters or white spaces or other character, regular expression still succeed.

if want following:

  1. starts +40
  2. contains total of 10 digits , plus sign).
  3. nothing else above

the following should trick: ^\+40\d{8}$. example available here.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -