I'd like to know how can I match text ONLY if there are both parentheses (starting and closing).
Currently, my RegExp is: ^1?\s?\(?\d{3}\)?[-\s]?\d{3}[-\s]?\d{4}$
.
It checks for US valid numbers, however \(?
and \)?
makes the difference. It should match the text if there is 0 of them or 2.
Some tests:
1 555)555-5555 - false
555)-555-5555 - false
(555-555-5555 - false
Now, they all return the same result - true.
Here is the link to it:
https://regexr.com/3kjei (^
is because I have to select only one string without any line break, please remove 2 other strings from it so you can see it returns true. All of the strings in this link should return true, just check it so only one string is in the text editor).
Thank you