Regular expressions (commonly shorted to “regex” or “regexp”) are sequences of characters that create search patterns. These search patterns can be powerful tools that help you to find and match text at scale so you can do things like validate, extract or replace that text.
They are really useful in programming but can be a bit intimidating if you’re not used to them. Here are a few good introductory courses and resources to get you started on learning how to use regular expressions.
Note that the exact syntax for using regular expressions can differ slightly by programming language, but the general principles are pretty much the same.
Regex101
The best way to get comfortable with using Regular Expressions is to actually use them. Regex101 lets you create and test patterns in real time and gives you tips and hints. It’s a great resource to use in conjunction with one of the courses listed below.
Note that Regex101 covers regular expressions for PHP, Javascript, Python and GoLang. If you’re interested in Ruby regular expressions check out Rubular.
RegexOne Interactive Tutorial
RegexOne is a free online tutorial that lets you try out regular expressions as you learn them. It takes a very gentle step by step approach to build your understanding of regular expressions, so it’s great for anyone who is completely new to regular expressions.
Regular Expressions – freeCodeCamp
This free interactive tutorial is part of freeCodeCamp’s JavaScript Algorithms and Data Structures Certification. But if you know some JavaScript, then you could do this separately.
It walks you through exercises and challenges to get you familiar with common regular expression patterns and uses.
Learn Regular Expressions – Scrimba
If you find videos helpful, Scrimba’s course builds on freeCodeCamp’s regular expressions course with screencasts. It also includes an interactive in-browser console that lets you try out your regular expressions while you’re learning.
Regular Expression Tutorial
This text-based tutorial introduces you to the basics of regular expressions, but also goes beyond that to more advanced topics.
Regular Expressions Cheat Sheet – DaveChild
Once you’ve got a basic handle on regular expressions, this simple cheatsheet will help you remember the most common patterns.
Keep going with our 31 Days of Learning. Sign up to our newsletter to keep updated!