I am currently working with the following regex to match a phone number
'\\([1-9]{3}\\)\\s{1}[0-9]{3}-[0-9]{4}'
But the above pattern is not allowing 0 in the first 3 digits and when I modify it to
'\\([0-9]{3}\\)\\s{1}[0-9]{3}-[0-9]{4}'
it is accepting 0 as the first digit. I would like to generate a regex which would not accept 0 for the first digit but does accept for the remaining digits.
I have modified the regex which I think will suit my needs but I am not entirely sure ( never ever did a regex pattern) and dont know how to test it on regex101
'\\([1-9]{1}[0-9]{2}\\)\\s{1}[0-9]{3}-[0-9]{4}'
if someone can help me out as in if you could point out if I am going in the right direction that would be amazing
I am looking for inverse of whats in this question, the answers in this make sure the number begins with a 0 but I am looking for inverse of the following implementation
Javascript Regex - What to use to validate a phone number?
Thank you, Vijay