I need it for this chlg: https://www.freecodecamp.com/challenges/validate-us-telephone-numbers
I need to check first does it contains any other character that is not digit, with exception of “(” , “)” .
And then to check other thing like validating number…
var regex = /[\D()]/g
1 Like
Can u take look at this regex
(\d\d\d) \d\d\d-\d\d\d\d
I need to search for it in
1 (555) 555-5555
but no success, but when i put this like
(\d\d\d)\S \d\d\d-\d\d\d\d
It finds. I expect when i put in regex whitespace (" "), that it literaly search for, am i wrong? Why we need to set this \S thing?
@nameToReachPeople try \(\d\d\d\) \d\d\d-\d\d\d\d
notice two extra “”
using only (\d\d\d) creates something called a Capturing group.
1 Like