Time to start learning how to regex
13 Mar 2021
1 minute ⏳
It's time for me to come out: I've been working as a professional developer for 6 years and I've never managed to write a regex without intense googling and the help of regex 101.
This needs to stop, so I decided to take advantage of the current lockdown and spend my Saturday morning doing some googling, and as it turns out... regular expressions are not that complicated. At all.
After a couple of minutes of googling, I landed on RegexOne and found a great and exhaustive tutorial that takes you through the basics of writing regular expressions.
The lessons are clear and concise and offer real-world examples with a nifty little exercise at the end of each chapter.
It took me about an hour to go through the 15 lessons of the basic tutorial touching everything, from the ABCs to capturing groups.
Once you're done with all the lessons you can take the Practice Problems which are useful tests that push you to write regular expressions that help in a developer's everyday life like:
- matching email addresses
- parsing HTML elements
- extract pieces of information from a log file
... and more.
So, whether you're a seasoned developer or just starting out in this world, I highly suggest you try out this tutorial and use Regex101 as a reference and code generator (this utility is actually very useful!) for more complex regular expressions.
I'll be diving more into this and I'll probably end up writing a follow-up, but for now, I'd say it's been a productive Saturday morning.