---
title: Regular Expressions
description: Regular expressions match and transform text patterns. You will learn the syntax, groups, lookarounds, greedy versus lazy matching, engine differences and how to write readable, correct patterns.
category: programming-tech
subcategory: programming-fundamentals
difficulty: beginner, intermediate, advanced
url: /subject/regular-expressions
---

# Regular Expressions

Regular expressions match and transform text patterns. You will learn the syntax, groups, lookarounds, greedy versus lazy matching, engine differences and how to write readable, correct patterns.

## Available Resources

1 Books • 1 Courses • 3 Websites • 1 Papers

## Papers

### 1. Implementing Regular Expressions (Regular Expression Matching Can Be Simple And Fast, and sequels)

**Author:** Russ Cox

Russ Cox's article series on regex engine implementation. Shows why backtracking engines can take exponential time, how Thompson NFA simulation guarantees linear time, and how RE2 handles submatches and real-world features. Includes working C code. Primary source explaining the engine differences, and why catastrophic backtracking happens.

**Difficulty:** Advanced | **Language:** English | **Price:** Free

**Link:** https://swtch.com/~rsc/regexp/

**Tags:** regex-engines, thompson-nfa, catastrophic-backtracking, re2, automata-theory

## Books

### 1. Mastering Regular Expressions, 3rd Edition

**Author:** Jeffrey E.F. Friedl

Jeffrey Friedl's book on how regex engines work and how to write efficient, correct patterns. Explains NFA versus DFA matching, backtracking, crafting and optimizing expressions, and covers Perl, Java, .NET and PHP specifics. Published 2006. Still the deepest treatment of engine mechanics and pattern efficiency; language chapters are dated but the core chapters are not.

**Difficulty:** Advanced | **Language:** English | **Price:** Paid

**Link:** https://www.amazon.com/dp/0596528124?tag=edmonddante07-20

**Tags:** regex-engines, nfa-vs-dfa, backtracking, regex-optimization, perl-regex

## Websites

### 1. regex101: Online Regex Tester and Debugger

A tool rather than a course, but its token explanations and backtracking debugger make it the practice environment every other resource here assumes. Free browser tool for writing and testing patterns against sample text. Explains each token in plain language, highlights capture groups, shows a step-by-step debugger of backtracking, and switches between PCRE, JavaScript, Python, Java, .NET, Go and Rust flavors.

**Difficulty:** Beginner | **Language:** English | **Price:** Free

**Link:** https://regex101.com/

**Tags:** regex-testing, regex-debugging, pcre, regex-flavors, capture-groups

### 2. Regular Expression HOWTO (Python Documentation)

**Author:** A.M. Kuchling

Official Python guide to the re module by A.M. Kuchling. Walks through metacharacters, compiling patterns, match versus search, grouping, named groups, lookahead assertions, verbose mode for readable patterns, and common pitfalls like greedy matching. Clearest applied walkthrough in a real language, with explicit coverage of readable patterns (re.VERBOSE) and common mistakes.

**Difficulty:** Beginner | **Language:** English | **Price:** Free

**Link:** https://docs.python.org/3/howto/regex.html

**Tags:** python-re, python, lookahead, named-groups, verbose-regex

### 3. Regular Expression Tutorial (Regular-Expressions.info)

**Author:** Jan Goyvaerts

The single best free resource: explains engine internals, not just syntax, and its flavor comparison tables are unmatched. Jan Goyvaerts's free tutorial and reference explaining how regex engines actually process patterns: backtracking, greedy versus lazy quantifiers, atomic groups, lookarounds, Unicode, and a flavor-by-flavor comparison of syntax across Perl, PCRE, Java, .NET, Python and JavaScript.

**Difficulty:** Intermediate | **Language:** English | **Price:** Free

**Link:** https://www.regular-expressions.info/tutorial.html

**Tags:** regex-engines, backtracking, lookarounds, regex-flavors, lazy-quantifiers, unicode-regex

## Courses

### 1. RegexOne: Learn Regular Expressions with Interactive Exercises

Short browser-based lessons, each followed by an exercise you must pass by writing a pattern. Covers literals, character classes, repetition, anchors, capture groups and alternation, then practice problems such as parsing emails, phone numbers and log lines. A great interactive, exercise-first entry point resource.

**Difficulty:** Beginner | **Language:** English | **Price:** Free

**Link:** https://regexone.com/

**Tags:** regex-basics, character-classes, capture-groups, anchors, regex-exercises

---

*This content is part of Dantes.io - Your Treasure Map to Knowledge*

*Curated by humans at Dantes.io. Personal study use welcome; republishing this curation requires permission (team@dantes.io).*

View this page online: https://dantes.io/subject/regular-expressions