No. I am just trying to understand why ?[ ] is considered invalid but ? works. I was under the impression [ ] would be matching a space. Just trying to wrap my head around RegEx a bit... I understand that it could still be a cleaner solution after looking at some of the other solutions.
No. I am just trying to understand why
?[ ]
is considered invalid but?
works. I was under the impression[ ]
would be matching a space. Just trying to wrap my head around RegEx a bit... I understand that it could still be a cleaner solution after looking at some of the other solutions./^\(?\d{3}\)?[ ]\d{3}[-]?\d{4}$/.test("(123)456-7890");
returns false in the dev console. It was returning true for you?This comment is hidden because it contains spoiler information about the solution