Easy-to-understand-resources for Learning Regular Expressions

Hi Campers,
I am trying to complete the Telephone-Number-Validator project but every time i try to “google” telephone number validation, i come across Regular Expressions. I have tried to learn it but failed to make sense of such /^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/ expressions. Are these things human-readable? Are there easy-to-understand resources for learning RegExp?

The problem with regex isn’t so much the learning resources as it is the syntax of regex. And yes, that is supposed to be human-readable. It isn’t that bad when you know a bit about the syntax, but it’s still not a very user friendly syntax.

It can also really help to use one of the online regex tools, like regexr or regex101 when learning and writing regex. Last, here is a video you can checkout as well.

1 Like

I would recommend going through the FCC regex lessons, I did them twice…the first time I rushed through and forgot everything afterwards. The second time through I took detailed notes and made a cheat sheet reference for myself that has come in handy for other projects. Aside from the FCC lessons I also use these two websites frequently to help with regex:

Regex Cheat Sheet
Regex Tester

Regex sytax and logic can be tricky but it’s been rewarding for me to learn and begin to use in various projects.

Good luck!

1 Like