Match Numbers and Letters of the Alphabet, Free Regex Course, freeCodeCamp Learn Regular Expressions

Lesson Summary

Today's lesson builds off previous lessons. In previous lessons, we learned how to use the hyphen (-) when grouping sets of characters to avoid typing all characters. For example, we are able to target the letters "a" through "g" by using a hyphen in this manner, "a-g". This helps us avoid having to type in each individual character. In today's lesson, we learn that we are able to also use a hyphen when targetting numbers. This also saves us from having to type out a lot of numbers. By using a hyphen in our regular expression we are able to save time from having to write out all the characters we are matching by allowing us to use a hyphen.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required