regex - Phone regular expression with dots and slashes -


i have simple regular expression check phone numbers: \+?(?:\d ?){7,20}

it´s working phones like:

  • 0034 123 456 789
  • +34123456789

and mix of that.

i include extend validation detecting "." or "-". example:

  • 0034.123.456.789
  • 123-456-789

you can use character class instead of final space of non-matching group :

\+?(?:\d[ .-]?){7,20} 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -