Hey guys,
The main problem I am having is trying to close the set of parenthesis. This problems is from the advances algorithm challenges. I have implemented a look ahead but for some reason it still does not match the first instance of the the parenthesis. Can you Help me out?
^(([1]{1}))?\s?\((?=[0-9]{3})\)?\s?[-]?([0-9]{3})[-]?\s?([0-9]{4})$
The following parameter is coming up as false when passed into my function
(555-555-5555
down below is what I have implemented without the look ahead .
function telephoneCheck(str) {
var checkagainst = /^([1]{1})?\s?\(?([0-9]{3})\)?\s?[-]?([0-9]{3})[-]?\s?([0-9]{4})$/g;
if (checkagainst.test(str)) {
return(true);
} else {
return(false);
}
}
telephoneCheck("(275)76227382");