Skip to content

Commit

Permalink
Final javascript project #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasholo committed Aug 27, 2023
1 parent a48ec89 commit dd05edf
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function telephoneCheck(str) {
const re = /^(1\s?)?\d{3}([-\s]?)\d{3}\2\d{4}$/;
const re2 = /^(1\s?)?\(\d{3}\)\s?\d{3}[-\s]\d{4}$/;
if (re.test(str)) {
return true;
}
else {return re2.test(str) ? true : false}
}

telephoneCheck("555-555-5555");

0 comments on commit dd05edf

Please sign in to comment.