Regex does not work correctly on iOS

advertisements

Can someone please explain the meaning of following regex :

^[+]?[0-9]{0,4}[ ]?(\([0-9]{1,6}\))?[0-9 ()/-]{4,}$

This does not allow me to validate (0049) (0)151-544/187 29 or (0049)(0)15154418729

I tried to debug and my understanding says that there is an issue with the number which has 2 open and closed brackets ().

If I make (0049) (0)151-544/187 29 as (0049) 151-544/187 29 , this works.

Can someone please help.


Your regex ^[+]?[0-9]{0,4}[ ]?(\([0-9]{1,6}\))?[0-9 ()/-]{4,}$ expressed as

If You need group1 multiple times add * to that group