Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Regular Expressions in JavaScript!

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Make the telephone validator we wrote earlier more flexible, allowing users to format their input any way they choose.
Resources
The following regex expression can match phone numbers while not allowing for non-digit (a-z) characters:
1?[\s-]?\(?(\d{3})\)?[\s-]?\d{3}[\s-]?\d{4}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
<noob />
17,062 Points1 Answer
-
John Nguyen
Full Stack JavaScript Techdegree Graduate 30,501 Points1 Answer
-
Lanai Lewis
10,400 Points3 Answers
-
David Aguirre
8,170 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up