I am trying to create a regular expression that checks the first two characters of an international phone number when a user enters it into:
Valid: + , 0 , + followed by a number , 00 , 0032476382763 , +324763
Invalid: 0 followed by a number different than 0 , ++ , everything that is not in the valid list
So far I have come up with:
/[0]|[00]|[+]|[+\d]]/g
But this confirms ++ , but not +2 . The problem is that I cannot figure out how to check depending on the number of characters (1 or 2).
I use this expression in javascript . Here's the regex I was working on: http://regexr.com/3br5v
My regex level is not very good, so any help would be greatly appreciated.
source share