I want to write a regex to match phone numbers in following format i.e.
1- without country code 9999999999
2 - with 1 digit country code +19999999999
3 - with country code and () +1(999)9999999
4 - with country code () and - +1(999)-999-9999
I wrote a regex which matches condition 2 but failed in 1,3 and 4.
^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$
As soon as I adds country code after + sign along with () and - my regex stops working.
How Can I fix it? I am not a regex pro and assembled my regex by trying different patterns that I got by googling.
Any help would be appreciated.