A regular expression (regex or regexp) is a sequence of characters that define a search pattern. It is an unofficial and free Regular Expressions book created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow.
This open book is licensed under a Creative Commons License (CC BY-SA). You can download Learning Regular Expressions ebook for free in PDF format (1.5 MB).
Table of Contents
Getting started with Regular Expressions
Anchor Characters: Caret (^)
Anchor Characters: Dollar ($)
Greedy and Lazy quantifiers
Lookahead and Lookbehind
Match Reset: \K
Matching Simple Patterns
Named capture groups
Password validation regex
Regex modifiers (flags)
Regular Expression Engine Types
Substitutions with Regular Expressions
Useful Regex Showcase
UTF-8 matchers: Letters, Marks, Punctuation etc.
When you should NOT use Regular Expressions