Awesome Regex curates the best regular expression tools, tutorials, libraries, and other resources, covering all major regex flavors.
Regular expressions (regex or regexp) are a powerful and concise way to search, parse, and process text. They’re built into many programming languages, text editors, IDEs, database engines, word processors, and other tools.
Contributions are welcome. Add links through pull requests (guidelines).
📖 Glossary
*A brief glossary of regular expression terms as used in this list.*
- **Regex engine:** Software that interprets and executes regular expressions, either built into a programming language or as a standalone library.
- **Regex flavor:** A unique set of regex syntax and behavior. Basic syntax is typically shared across flavors, but more advanced features often vary, sometimes in subtle or incompatible ways. A flavor might be shared across multiple implementations or programming languages.
- Ex: The “JavaScript” flavor is defined by the ECMAScript spec; implemented by multiple engines (V8, etc.).
- Ex: The “PCRE” flavor is the PCRE2 library, used by numerous programming languages and tools.
- Ex: Ruby swapped its regex implementation twice from version 1.8 → 1.9 → 2.0, so each used a distinct flavor. The Ruby 2.0+ flavor is referred to here as either “Ruby” or “Onigmo” (the underlying regex library).
- **Non-backtracking engine:** A regex implementation that uses a non-backtracking algorithm and runs in linear time. This rules out worst case performance from superlinear backtracking, but it's slower with some patterns and precludes some useful features like backreferences.
Featured resource
</a>
Regex+ is a lightweight JavaScript library for more readable, high-performance, native JavaScript regexes with powerful features including free spacing, atomic groups, possessive quantifiers, subroutines, definition groups, and context-aware interpolation.
Build regexes without writing regex syntax or code.
ChatGPT and other LLMs - Ex: “create a regex that matches X and explain it step by step”.
RegexMagic (Windows, $40) - Generate regexes using samples and rules.
Flavors: Emulates hundreds of flavors/versions.
✳️ Notable mentions
- [Regex Generator](https://regex-generator.olafneumann.org/) \[[*GitHub*  ](https://github.com/noxone/regex-generator)] - Generate simple regexes from a sample text.
- [Regex.ai](https://regex.ai/) - Mark samples in a text and use AI to generate potential regexes.
Visualizers
Visualize how your regular expressions are structured or operate.
Regex Vis [GitHub] - Create railroad diagrams, with visual editor. Flavor: JavaScript.
ℹ️ With backtracking engines, how you craft a regex can affect how fast it finds matches or reports failures.
✳️ Notable mentions
- [Performance of Regular Expressions](https://medium.com/textmaster-engineering/performance-of-regular-expressions-81371f569698) - On backtracking performance, with detailed examples.
Regex DB - Solutions include basic descriptions and examples of matching and non-matching text.
⚠️ Word of warning
Many regexes found online are low quality. It's risky to use regexes you don't fully understand in code, since they might have false positives/negatives, be vulnerable to performance problems with certain target strings, or assume a different regex flavor.
JavaScript regex libraries
Open source JavaScript libraries for advanced regex use and processing.
Alternative regex builders and engines
Regex+ - A template tag for extended, readable, high-performance JavaScript regexes.
Oniguruma-To-ES - Convert Oniguruma patterns to native JavaScript regexes.
The history of improvements to regular expressions in the JavaScript standard. Starting with ES2018, includes links to the TC39 proposals where features were developed and discussed.
ES3 (1999) introduced regular expressions.
ES5 (2009) fixed unintuitive behavior by creating a new object every time regex literals are evaluated [explainer], and allowed regex literals to use unescaped forward slashes within character classes (/[/]/).
Flag y (sticky), which anchors matches to lastIndex.
Flag u (unicode) [explainer] [2016 spec fix], which adds Unicode code point escapes via \u{…}, strict errors (for unreserved escapes, octal escapes, quantified lookahead, and unescaped special characters in some contexts), Unicode case-folding for flag i, and code point matching (with impact on quantifiers, character classes, ranges, and built-in sets).
Getter RegExp.prototype.flags, the ability to copy a regex using RegExp (optionally with new flags), and support for subclassing RegExp (along with RegExp.prototype[Symbol.match/replace/search/split] and RegExp[Symbol.species]).
ES2020 added string method matchAll (which returns an iterator), plus RegExp.prototype[Symbol.matchAll].
ES2022 added flag d (hasIndices), which provides start/end indices for matched substrings.
ES2024 added flag v (unicodeSets) [explainer] as an upgrade to flag u, which adds a set of multicharacter “properties of strings” to \p{…}, multicharacter elements within character classes via \p{…} and \q{…|…}, nested character classes, set operators […--…] and […&&…], and different escaping rules within character classes. It also fixes case-insensitive matching for \p and \P within negated [^…].
Editions from ES2019 onward have added additional Unicode properties that can be used via \p{…} and \P{…}. ES2021 added string method replaceAll, although the only difference from ES3’s replace when given a regex is that it throws if not using flag g.
➕ See also
- [*Regexes Got Good: The History And Future Of Regular Expressions In JavaScript*](https://www.smashingmagazine.com/2024/08/history-future-regular-expressions-javascript/)
- Backcompat libraries: [regexpu  ](https://github.com/mathiasbynens/regexpu), [regenerate  ](https://github.com/mathiasbynens/regenerate) ([Unicode property sets  ](https://github.com/mathiasbynens/regenerate-unicode-properties)).
- Chrome's `l` (`linear`) regex flag, behind a V8 flag \[[*explainer*](https://v8.dev/blog/non-backtracking-regexp)] \[[*how to run*](https://www.chromium.org/developers/how-tos/run-chromium-with-flags/)].
- [Can I use](https://caniuse.com/) - Up-to-date browser support tables for individual features.
🔮 Future: Active proposals
- [Extended mode and comments  ](https://github.com/tc39/proposal-regexp-x-mode) (2021) - Flag `x` (`extended`) with insignificant whitespace and line comments (`#…`), plus inline comments via `(?#…)`.
- [Atomic operators  ](https://github.com/tc39/proposal-regexp-atomic-operators) (2021) - Atomic groups via `(?>…)` and possessive quantifiers (ex: `*+`, `++`).
- [Buffer boundaries  ](https://github.com/tc39/proposal-regexp-buffer-boundaries) (2021) - Anchors `\A` and `\z`, not affected by flag `m`.
- [\R escape  ](https://github.com/tc39/proposal-regexp-r-escape) (2021) - Outside character classes, `\R` matches any line terminator.
- [Restrict subclassing support in built-ins  ](https://github.com/tc39/proposal-rm-builtin-subclassing) (2020) - Scaled back `RegExp` subclassing.
- [Legacy RegExp features  ](https://github.com/tc39/proposal-regexp-legacy-features) (2015) - Standardization of legacy features.
Books
A curated list of regex books.
Regular Expressions Cookbook, 2nd Edition (2012) by Jan Goyvaerts and Steven Levithan - Regex tutorial with code samples for eight programming languages, 100+ regex recipes for practical problems, and a deep focus on cross-flavor differences.
Mastering Regular Expressions, 3rd Edition (2006) by Jeffrey Friedl - A computer science classic, best for people who already know the basics. Includes good coverage of crafting efficient regexes.
Flavors: Dedicated chapters on Java, .NET, Perl, and PHP (PCRE), with more limited coverage of Python, Tcl, command line tools, etc.
Introducing Regular Expressions (2012) by Michael Fitzgerald - An intro for programmers new to regular expressions that sticks to the basics.