awesome-regex

Regex resource

A curated collection of regular expression tools and resources.

Curated collection of awesome regex tools, tutorials, libraries, etc.

GitHub

260 stars
8 watching
8 forks
last commit: 4 months ago
awesomeawesome-listregexregexpregular-expression

Testers

regex101
RegexBuddy ( , $40) -
RegExr [ ] -

Testers / RegExr

fork Languages: 🇺🇸, 🇨🇳 ( )

Testers

RegexLearn [ ] - (JavaScript)
regexplained [ ] - (JavaScript)
RegViz JavaScript:
Regex Storm .NET: [ ]
PHP Live Regex PCRE:
Pythex Python:
Rubular Ruby:
GNU sed REPL sed:
CyrilEx [ ] - Java, JavaScript, MySQL, PHP, Python, Ruby
Patterns ( , $3) - Bash, Emacs, grep, Java, Oniguruma, PCRE, POSIX BRE, POSIX ERE, Ruby, sed
RegexPlanet [ ] - Go, Haskell, Java, JavaScript, .NET, Perl, PHP, PostgreSQL, Python, Ruby, Tcl, XRegExp

Syntax-free regex builders

ChatGPT (and other LLMs) - Ex:
RegexMagic ( , $40) - Generate regexes using samples and rules
Regex Generator [ ] - Generate simple regexes from a sample text
Regex.ai Mark samples in a text and use AI to generate potential regexes

Visualizers

Regex Vis [ ] - Create railroad diagrams, with visual editor. Flavor: JavaScript
Regulex [ ] - Create railroad diagrams. Flavor: JavaScript
Nodexr [ ] - Graphical editor with visual hierarchy. Flavor: .NET
Regex Nodes [ ] - Graphical editor with visual hierarchy. Flavor: JavaScript
Debuggex Create railroad diagrams. Flavors: JavaScript, PCRE, Python
Regexper [ ] - Create railroad diagrams. Flavor: JavaScript

Grep-like tools / Command line

ripgrep 49,203 5 months ago Better and faster grep. Recursively searches directories while respecting gitignore rules and skipping hidden/binary files

Grep-like tools / GUI

Aba Search and Replace ( , $30) - Displays matches as you type
PowerGREP ( , $159) - Can search through archives, binary files, PDFs, docs/sheets, emails, etc., via its GUI or the command line
PowerRename 112,309 3 months ago ( ) - Rename files using regexes

Tutorials / Traditional

Regular-Expressions.info Covers numerous regex flavors
The Modern JavaScript Tutorial: Regular expressions [ ] - Guide to using regexes in JavaScript

Tutorials / Traditional / The Modern JavaScript Tutorial: Regular expressions

others Languages: 🇺🇸, 🇪🇸, 🇫🇷, 🇮🇹, 🇯🇵, 🇷🇺, 🇺🇦, 🇨🇳 (partial for )

Tutorials / Traditional

RexEgg Detailed tutorial with advanced topics
learnbyexample [ ] - Ebooks on regexes ( , , ) and command line text processing
Regular Expressions for Regular Folk [ ] - Visual, example-based ebook for beginners

Tutorials / With interactive exercises

RegexLearn [ ] - Interactive tutorial and practice problems
RegexOne Interactive tutorial and practice problems

Tutorials / Videos

Demystifying Regular Expressions Great presentation for beginners, by Lea Verou at HolyJS 2017 (1hr 12m)
Learn Regular Expressions In 20 Minutes Live syntax walkthrough in a regex tester, by Kyle Cook
Udemy Many options for video courses are available on ($)

Regex engines / Documentation

Manual Boost.Regex:
Regular expressions library C++:
Introduction Hyperscan:
Regular Expressions ICU:
Pattern Java: ,
RegExp JavaScript: , , ,
Overview .NET: , ,
RE 625 9 months ago Onigmo:
RE 2,331 4 months ago Oniguruma:
Pattern PCRE2: ,
Syntax Perl: , ,
re Python:
Syntax 9,023 3 months ago RE2:
regex Rust: ,
regexp Go: - Flavor: RE2
Regular Expressions MySQL: - Flavor: ICU
Regular Expressions PHP: - Flavor: PCRE
Regexp Ruby: - Flavor: Onigmo
NSRegularExpression Swift: - Flavor: ICU

Regex engines / Source code

Boost.Regex 86 3 months ago Popular C++ regex library
Hyperscan 4,857 10 months ago Intel's high-performance library, used for
ICU 2,870 3 months ago Unicode org's package with full Unicode support
Java: java.util.regex 20,082 3 months ago JDK standard regexes

Regex engines / Source code / JavaScript:

JavaScriptCore: RegExp 8,165 3 months ago Regex engine used by Safari
V8: Irregexp 23,582 3 months ago Regex engine used by Chrome, Edge, , etc

Regex engines / Source code

.NET: System.Text.RegularExpressions 15,518 3 months ago Shared by all .NET languages (C#, VB, etc.)
Onigmo 625 9 months ago Forked from Oniguruma. Used by Ruby 2.0+
Oniguruma 2,331 4 months ago Popular C regex library used by Ruby 1.9, TextMate grammars, etc
PCRE2 925 3 months ago Popular C regex library used by PHP, R, etc
Perl 1,999 3 months ago See
Python: re 64,132 3 months ago and - Standard and extended regex libraries
RE2 9,023 3 months ago Popular C++ regex library used by Go, etc. Non-backtracking engine
Rust: regex 3,580 4 months ago Non-backtracking engine

Regex engines / Flavor differences

Regular Expression Feature Comparisons Ron Buckton: [ ]
Tools & Languages Regular-Expressions.info:
Named capture Steven Levithan: ,
Comparison of regular expression engines Wikipedia:

Performance / Crafting efficient regexes

Runaway Regular Expressions: Catastrophic Backtracking Exploration and solutions for superlinear backtracking
Book: High Performance JavaScript (2010) -
Book: Mastering Regular Expressions, 3rd Edition (2006) -
Performance of Greedy vs. Lazy Regex Quantifiers Illustrates the mechanics of backtracking
Performance of Regular Expressions On backtracking performance, with detailed examples

Performance / Regex engine optimization

Regular Expression Matching Can Be Simple And Fast On non-backtracking engines. A includes comparisons of RE2 and PCRE performance
Regular Expression Improvements in .NET 7 and - Includes detailed explanations of performance optimizations
ripgrep is faster than {grep, …} Includes details about what makes ripgrep and Rust's fast

Performance / Benchmarking

rebar 233 5 months ago Cross-engine benchmarking libraries: ,
Boost.Regex: Performance Compares Boost, C++ , and others

Performance / ReDoS checkers

regex.rip Test a regex for ReDoS vulnerability
recheck 256 3 months ago [ ] - JavaScript and Scala library for detecting ReDoS vulnerability. Can be used as an ESLint plugin
vuln-regex-detector 320 about 3 years ago Perl library for detecting ReDoS vulnerability

Collections of patterns

Book: Regular Expressions Cookbook, 2nd Edition (2012) - High-quality solutions with detailed explanations
Regex DB Solutions include basic descriptions and examples of matching and non-matching text

JavaScript regex libraries / Alternative regex builders and engines

Regex+ 521 4 months ago A template tag for extended, readable, high-performance JavaScript regexes
Oniguruma-To-ES 61 3 months ago Convert Oniguruma patterns to native JavaScript regexes
XRegExp 3,307 4 months ago [ ] - Extended regex syntax, flags, and utils; useful for backcompat
incr-regex-package 13 about 1 year ago Partial/incremental matching, used by for input validation with a regex mask
node-re2 505 7 months ago Use other engines via WASM bindings: (RE2), (Rust's ), (Oniguruma)

JavaScript regex libraries / Abstracted regex syntax

Rexx 2 about 1 year ago A template tag that uses structured syntax with variables and comments
Melody 4,638 4 months ago [ ] - A language that compiles to regexes
compose-regexp.js 145 6 months ago Compose with functions: , (implementations for ), [ ], [ ]

JavaScript regex libraries / Regex processors

regexpp 24 5 months ago AST builders: (used by ESLint), (includes optimizer, etc.), /

JavaScript regex libraries / Regex processors / regexpp

AST Explorer: RegExp View ASTs generated by regexp-tree, regexpp, and regjsparser
regexp-ast-analysis 3 9 months ago [ ] - Analyze AST nodes produced by regexpp

JavaScript regex libraries / Regex processors

Regex Colorizer 176 7 months ago Highlight regex syntax: [ ],
eslint-plugin-regexp 701 3 months ago Find regex mistakes and improvements: [ ],
randexp.js 1,836 about 1 year ago Generate strings that match a given regex: ,
regexgen 3,344 about 1 year ago Generate a regex from given strings:

JavaScript regex evolution

explainer ES5 (2009) fixed unintuitive behavior by creating a new object every time regex literals are evaluated [ ], and allowed regex literals to use unescaped forward slashes within character classes ( )
explainer ES6/ES2015 added: [ ]

JavaScript regex evolution / explainer

explainer Flag ( ) [ ] [ ], which adds Unicode code point escapes via , strict errors (for unreserved escapes, octal escapes, quantified lookahead, and unescaped special characters in some contexts), Unicode case-folding for flag , and code point matching (with impact on quantifiers, character classes, ranges, and built-in sets)

JavaScript regex evolution

flag s 88 about 3 years ago ES2018 added ( ), , , and (via and which require flag ; see )
matchAll 99 almost 4 years ago ES2020 added string method (which returns an iterator), plus
flag d 65 almost 3 years ago ES2022 added ( ), which provides start/end indices for matched substrings
flag v 76 over 1 year ago ES2024 added ( ) [ ] as an upgrade to flag , which adds a set of multicharacter "properties of strings" to , multicharacter elements within character classes via and , nested character classes, set operators and , and different escaping rules within character classes. It also fixes case-insensitive matching for and within negated
Regexes Got Good: The History And Future Of Regular Expressions In JavaScript
regexpu 234 6 months ago Backcompat libraries: , ( )
explainer Chrome's ( ) regex flag, behind a V8 flag [ ] [ ]
Can I use Up-to-date browser support tables for individual features
Duplicate named capturing groups 28 about 2 years ago (2022) - Ex:
Extended mode and comments 27 over 3 years ago (2021) - Flag ( ) with insignificant whitespace and line comments ( ), plus inline comments via
Pattern modifiers 46 5 months ago (2021) - Ex: , ,
Atomic operators 17 almost 3 years ago (2021) - Atomic groups via and possessive quantifiers (ex: , )
Buffer boundaries 7 almost 3 years ago (2021) - Anchors and , not affected by flag
\R escape 5 over 3 years ago (2021) - Outside character classes, matches any line terminator
Restrict subclassing support in built-ins 34 11 months ago (2020) - Scaled back subclassing
RegExp escaping 375 4 months ago (2015) -
Legacy RegExp features 41 over 1 year ago (2015) - Standardization of legacy features

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
Introducing Regular Expressions (2012) by Michael Fitzgerald - An intro for programmers new to regular expressions that sticks to the basics

Articles

The World's Shortest Regex Compiler? and a on optimization - Introduction to writing a non-backtracking regex engine (in JavaScript)
Regex Legends: The People Behind the Magic Influential people behind the technology
Fun With .NET Regex Balancing Groups Advanced usage of a .NET-only regex feature

Communities

Reddit: r/regex
Stack Overflow: [regex]

Miscellaneous

Regex Chrome extension: - Regex search on webpages via
regex101 Regex Quiz Quiz: - Requires sign-in
Regex Crossword Games: , , ($)
xkcd Comics: ,