Andrii Raikov
How Regex Works: The Secret Sauce Behind Pattern Matching
#1about 4 minutes
Solving a LeetCode regex matching challenge
A LeetCode problem requiring a custom regex matcher for the dot and asterisk characters serves as the motivation for exploring how regex engines work.
#2about 2 minutes
Understanding the scalability limits of a naive approach
The initial linked-list implementation is not extensible enough to handle complex patterns like a real-world email validation regex.
#3about 3 minutes
How regex works using finite automata
Regular expressions can be modeled as finite automata, or state machines, which describe a set of character strings through states and transitions.
#4about 2 minutes
Comparing deterministic and non-deterministic finite automata
Non-deterministic Finite Automata (NFA) are more flexible for representing regex because a single input can lead to multiple possible next states.
#5about 5 minutes
Building an NFA from regular expression components
A complex regular expression is converted into an NFA by combining smaller NFA components for concatenation, alternation, and repetition operators.
#6about 2 minutes
The performance pitfalls of the backtracking algorithm
The backtracking approach, where the engine guesses a path and reverts on failure, can lead to exponential time complexity for complex patterns.
#7about 1 minute
Simulating an NFA by tracking all possible states
A more efficient simulation method avoids backtracking by simultaneously tracking the entire set of possible states the machine could be in at any point.
#8about 5 minutes
Implementing a simple NFA regex matcher in Go
A practical implementation involves compiling the regex pattern into an NFA data structure and then iterating through the input string while tracking the current set of active states.
#9about 2 minutes
Beyond one algorithm for real-world regex engines
Production-grade regex engines often use a hybrid approach, selecting from different algorithms like NFA simulation or backtracking based on the specific pattern.
Related jobs
Jobs that call for the skills explored in this talk.
Eltemate
Amsterdam, Netherlands
Intermediate
Senior
TypeScript
Continuous Integration
+1
MARKT-PILOT GmbH
Stuttgart, Germany
Remote
€75-90K
Senior
Java
TypeScript
+1
tree-IT GmbH
Bad Neustadt an der Saale, Germany
€54-80K
Intermediate
Senior
Java
TypeScript
+1
Matching moments
02:33 MIN
Why you might not need JavaScript for everything
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
02:49 MIN
Using AI to overcome challenges in systems programming
AI in the Open and in Browsers - Tarek Ziadé
08:07 MIN
Exploring modern JavaScript performance and new CSS features
WeAreDevelopers LIVE – AI, Freelancing, Keeping Up with Tech and More
03:07 MIN
Final advice for developers adapting to AI
WeAreDevelopers LIVE – AI, Freelancing, Keeping Up with Tech and More
04:56 MIN
Recreating React components using AI and dev tools
WeAreDevelopers LIVE – AI, Freelancing, Keeping Up with Tech and More
09:00 MIN
Navigating the growing complexity of modern CSS
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
11:32 MIN
The industry's focus on frameworks over web fundamentals
WeAreDevelopers LIVE – Frontend Inspirations, Web Standards and more
03:31 MIN
The value of progressive enhancement and semantic HTML
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
Featured Partners
Related Videos
WeAreDevelopers LIVE - Vector Similarity Search Patterns for Efficiency and more
Chris Heilmann, Daniel Cranney, Raphael De Lio & Developer Advocate at Redis
The Eventloop in JavaScript - How does it work?
Christian Woerz
Tips, tricks and quirks in .NET
Paweł Łukaszuk
From Syntax to Singularity: AI’s Impact on Developer Roles
Anna Fritsch-Weninger
10 must-know design patterns for JS Devs
Erick Wendel
Exploring the Latest Features of .NET and C# by Building a Game
Rainer Stropek
Algebraic Data Types + Pattern Matching = Elegant and readable Java code
Balkrishna Rawool
A beginner’s guide to modern natural language processing
Jodie Burchell
Related Articles
View all articles



From learning to earning
Jobs that call for the skills explored in this talk.

Code Healers LLC
Hinesville, United States of America
Remote
€20-30K
Junior
Intermediate
React
JavaScript
TypeScript
+1


Code Healers LLC
Hinesville, United States of America
Remote
€30-40K
Intermediate
Senior
.NET
React
JavaScript
+2

Visonum GmbH
Remote
Junior
Intermediate
React
Redux
TypeScript

The Rolewe
Charing Cross, United Kingdom
API
Python
Machine Learning


Abnormal AI
Intermediate
API
Spark
Kafka
Python

Riverty GmbH
Berlin, Germany
Remote
Java
Python
TypeScript
