A Mysterious, Little Course on Regular Expressions
A Free, Online Course on How to Write Regular Expressions in Real-world Applications
If you have never heard of regular expressions, or find them cryptic and confusing, or were taught their mathematical notation disconnected from real-world syntax... you are not alone and this short, on-line course is designed for you.
Regular expressions are patterns you can write to flexibly and efficiently search (and replace!) text. Knowing how to write and when to use regular expressions is a valuable skill to have for web and mobile application developers, software engineers, data scientists, and in many other fields. You can use them to quickly validate, search, and sanitize textual data.
After completing this free course, you will be able to write regular expressions and use them with more confidence in modern text editors, HTML input field validators, programming languages, at the command-line, and everywhere else they're available.
About Your Tour Guide
Hey, hey! I'm Kris Jordan (he/him/his), a professor who teaches computer science at the University of North Carolina at Chapel Hill.
Back when I first tried to learn regular expressions it felt like a lot of weird, cryptic incantations to memorize. I couldn't separate the essential concepts to understand from the merely convenient shorthand add-ons. When I was was taught their theoretical basis, I struggled to connect academic notation and abstract examples with real-world syntax and concrete applications.
So I'm teaching this for you the way I wish regular expressions were introduced to me: fundamentals-first with the syntax of modern applications in an actively hands-on, follow-along style. Are the "bank heist mystery" storylines a bit silly and extra? I hope so! Lessons on regular expressions are traditionally served cold and stale; I wanted to make you something fresh and spicy. Enjoy...
Disclaimer: I am still working on additional lessons for the course!
There are more short lessons planned but not yet recorded.
The easiest way follow along as they drop is to subscribe on YouTube by clicking the red button:
Lesson 1. Write Your First Regular Expressions (9 min)
Setup your Machine for the Course (5 min)
This course is designed for you to follow along with the examples and experiment on your own. To simpltw
The "And then" Operator (aka concatenation)
Lesson 2. Use the "Or" Operator (aka Alternation | Union) and Precedence (12 min)
[Link]
Test one two three.
Lesson 3. The "Repeats" Operator (aka Closure | Quantifiers)
Frequently Asked Questions
I have a question, where can I ask it?
If your question regards the content of one of the videos, feel free to leave a comment in the video and I'll do my best to respond quickly!
If your question is outside the scope of a specific video, ask me on Twitter by tagging me with @KrisJordan. I may be able to make an additional lesson for the course addressing it!
Aren't regular expressions just a theoretical concept in computer science classes about finite automata and proving theorems?
Regular Expressions are a foundational, theoretical result in computer science. As a professor who teaches computer science, I love this! But unfortunately this lineage often results in regular expressions being introduced in a dry, academic way disconnected from modern applications. This course intentionally does not teach the formal theory of regular expressions and automata. This short course is meant to be complementary to a full, formal course on the theory of languages and computation. I hope that in seeing the applications of regular expressions first, you will find their underlying theory more compelling.
Where can you actually use regular expressions?
Regular Expressions are built into every text editor for programmers and data scientists (including Visual Studio Code, Atom, vim, emacs, and so on), available to you as a programmer in every programming language (including Python, JavaScript, Java, C, and so on), and are used in many useful command-line tools (grep
, sed
, awk
, and so on). They're even built into some marketing tools such as Google Analytics.