I am new to java regex. I have to validate the telephone phone numbers using java regex. I have tried some combinations, this being the best result so far:
^\s*(?:\+?(011))?[-. (]*?(1|32)?[-. (]*(703|701|21)?[-. )]*(\d{3})?[-. ]*(\d{4})?\s*$
Acceptable inputs:
1. ####
2. (###)###-####
3. ###-####
4. +#(###)###-####
5. #####.#####
Unacceptable inputs:
1. ###
2. #/###/###/####
3. nr ###-###-####
4. ##########
5. (###) ###-####
where # highlights numbers/digits
Thanks in advance.