awesome-regex
🦉 A curated collection of regex tools, tutorials, libraries, etc.
https://github.com/slevithan/awesome-regex
Last synced: 26 days ago
JSON representation
About
Past sponsors
- <img src="https://github.com/antfu.png" width="40" height="40">
- <img src="https://github.com/brc-dd.png" width="40" height="40">
- sponsoring
Regex processors, utilities, and more
- Steven Levithan - regex/graphs/contributors).
Sponsors and backers
Articles
Regex processors, utilities, and more
- *The World's Shortest Regex Compiler?* - dfa) on optimization - Introduction to writing a non-backtracking regex engine (in JavaScript).
- *Regex Legends: The People Behind the Magic* - Influential people behind the technology.
Books
Regex processors, utilities, and more
- *Regular Expressions Cookbook, 2nd Edition* - 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* - A computer science classic, best for people who already know the basics. Includes good coverage of crafting efficient regexes.
- *Introducing Regular Expressions* - An intro for programmers new to regular expressions that sticks to the basics.
Collections of patterns
ReDoS checkers
- Book: Regular Expressions Cookbook, 2nd Edition - High-quality solutions with detailed explanations.
- Regex DB - Solutions include basic descriptions and examples of matching and non-matching text.
Communities
Regex processors, utilities, and more
Grep-like tools
Command line
- Feature comparison of grep-like tools
- ripgrep - Better and faster grep. Recursively searches directories while respecting gitignore rules and skipping hidden/binary files.
- nomino - Rename files uses regexes.
GUI
- Aba Search and Replace - Displays matches as you type.
- PowerGREP - Can search through archives, binary files, PDFs, docs/sheets, emails, etc., via its GUI or the command line.
- PowerRename - Rename files using regexes.
JavaScript regex evolution
Regex processors, utilities, and more
- [*explainer*
- [*explainer*
-
[*explainer*
- folding for flag
i, and code point matching (with impact on quantifiers, character classes, ranges, and built-in sets). - [*explainer* - tos/run-chromium-with-flags/)].
- Can I use - Up-to-date browser support tables for individual features.
-
flag `s`
- regexp-lookbehind), named capture, and Unicode properties (via
\p{…}and\P{…}which require flagu; see list). - `matchAll`
- `replaceAll`
- flag `d`
-
flag `v`
- v-flag)] 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\pand\Pwithin negated[^…]. - regexpu - unicode-properties)).
-
Extended mode and comments
- Flag
x(extended) with insignificant whitespace and line comments (#…), plus inline comments via(?#…). -
modifiers
- duplicate-named-capturing-groups) in separate alternation paths, and
RegExp.escape. -
Atomic operators
- Atomic groups via
(?>…)and possessive quantifiers (ex:*+,++). -
Buffer boundaries
- Anchors
\Aand\z, not affected by flagm. -
\R escape
- Outside character classes,
\Rmatches any line terminator. -
Restrict subclassing support in built-ins
- Scaled back
RegExpsubclassing. - Legacy RegExp features - Standardization of legacy features.
- standard
- *Regexes Got Good: The History And Future Of Regular Expressions In JavaScript*
JavaScript regex libraries
Abstracted regex syntax
- Rexx - A template tag that uses structured syntax with variables and comments.
- Melody - lavi.github.io/melody/book/)] - A language that compiles to regexes.
- compose-regexp.js - regexp](https://github.com/unjs/magic-regexp) [home], Super Expressive [playground].
Alternative regex builders and engines
- Regex+ - A template tag for extended, readable, high-performance JavaScript regexes.
- node-re2 - oniguruma](https://github.com/microsoft/vscode-oniguruma) (Oniguruma).
- Oniguruma-To-ES - Convert Oniguruma patterns to native JavaScript regexes.
Regex processors, utilities, and more
- AST Explorer: RegExp - regexp-ast-viewer/).
- regexp-ast-analysis - ast-analysis/docs/latest/)] - Analyze AST nodes produced by regexpp.
- Regex Colorizer - colorizer/demo/)] - Highlight regex syntax.
- eslint-plugin-regexp - meshi.github.io/eslint-plugin-regexp/)] - ESLint plugin for finding regex mistakes, etc.
- randexp.js - to-strings](https://github.com/wimpyprogrammer/regex-to-strings).
- regexgen - Generate a regex that matches a set of strings.
- regexpp - tree](https://github.com/DmitrySoshnikov/regexp-tree), regjsparser/regjsgen, regexp-simple-parser.
- regex-utils - Check regex equivalence, build regex intersections, and other utilities.
- regex-to-mermaid - Generate Mermaid diagrams to visualize regexes.
-
arkregex
-
RegExp-equivalent constructor with TS types. - super-regex - Add an execution timeout to regexes.
- regex-partial-match - regex-package](https://github.com/nurulc/incr-regex-package).
Miscellaneous
Regex processors, utilities, and more
- regex101 Regex Quiz - Requires sign-in.
- Regex Crossword - machina/) ($).
- xkcd
Performance
Benchmarking
- rebar - benchmark](https://github.com/mariomka/regex-benchmark).
Crafting efficient regexes
- Runaway Regular Expressions: Catastrophic Backtracking - Exploration and solutions for superlinear backtracking.
- Book: High Performance JavaScript - Chapter 5: Strings and Regular Expressions.
- Book: Mastering Regular Expressions, 3rd Edition - Chapter 6: Crafting an Efficient Expression.
- Performance of Greedy vs. Lazy Regex Quantifiers - Illustrates the mechanics of backtracking.
- Performance of Regular Expressions - On backtracking performance, with detailed examples.
Flavor differences
ReDoS checkers
- regex.rip - Test a regex for ReDoS vulnerability.
- recheck - labs.github.io/recheck/)] - JavaScript and Scala library for detecting ReDoS vulnerability. Can be used as an ESLint plugin.
- vuln-regex-detector - Perl library for detecting ReDoS vulnerability.
Regex engine optimization
- Regular Expression Matching Can Be Simple And Fast - On non-backtracking engines. A follow up includes comparisons of RE2 and PCRE performance.
- Regular Expression Improvements in .NET 7 - performance-improvements-in-net-5/) - Includes detailed explanations of performance optimizations.
Regex engines
Documentation
- RegExp - US/docs/Web/JavaScript/Reference/Regular_expressions), Guide, Cheatsheet.
- Regular Expressions
- Pattern - summary.html).
- Overview - us/dotnet/standard/base-types/regular-expression-language-quick-reference), API.
- RE
- Syntax
- Syntax
- Grammars - best-practices)).
- Regular Expressions - Flavor: PCRE.
- Regexp - Flavor: Onigmo.
- regexp - Flavor: RE2.
- RE
- Pattern
- Regular Expressions - Flavor: ICU.
- Introduction
Flavor differences
- Tools & Languages
- Named capture
- Comparison of regular expression engines
- Regular Expression Feature Comparisons - features)].
Source code
- V8: Irregexp - Regex engine used by Chrome, Edge, Firefox, etc.
- Java: java.util.regex - JDK standard regexes.
- .NET: System.Text.RegularExpressions - Shared by all .NET languages (C#, VB, etc.).
- Perl - See perlreguts.
- Python: re - regex) - Standard and extended regex libraries.
- JavaScriptCore: RegExp - Regex engine used by Safari.
- ICU - Unicode org's package with full Unicode support.
- Boost.Regex - C++ regex library.
- Hyperscan - Intel's high-performance library, used for DPI.
- Onigmo - Forked from Oniguruma. Used by Ruby 2.0+.
- Oniguruma - C regex library used by Ruby 1.9, TextMate grammars, etc.
- PCRE2 - Popular C regex library used by PHP, R, etc.
- RE2 - Popular C++ regex library used by Go, etc. Non-backtracking engine.
- Rust: regex - Non-backtracking engine.
Syntax-free regex builders
-
ChatGPT
- Ex: "create a regex that matches
Xand explain it step by step". - RegexMagic - Generate regexes using samples and rules.
- Regex Generator - generator)] - Generate simple regexes from a sample text.
- Regex.ai - Mark samples in a text and use AI to generate potential regexes.
Testers
- regex101 - Best free and best web-based tester.
- RegexBuddy - Best tester.
- RegExr - Best open source tester.
- fork
- RegexLearn - Best multilingual tester (JavaScript).
- regexplained - Best tester for presentations (JavaScript).
- PHP Live Regex
- Pythex
- Rubular
- CyrilEx - Java, JavaScript, MySQL, PHP, Python, Ruby.
- Patterns - Bash, Emacs, grep, Java, Oniguruma, PCRE, POSIX BRE, POSIX ERE, Ruby, sed.
- RegexPlanet - Go, Java, JavaScript (Bun, Deno, Node.js), .NET, Perl, PHP, PostgreSQL, Python, Ruby, Rust, Swift, Tcl, XRegExp.
- GNU sed REPL
- pcre2test - Includes regex debugger. Flavor: PCRE.
- rxrx - Includes regex debugger (video intro). Flavor: Perl.
- fancy-regex playground - regex/fancy-regex/tree/main/playground)].
- RegViz
- Regex Storm - storm)].
- Swift Regex - Includes regex debugger, DSL builder.
- RegexPilot - Best Mac-native tester.
Tutorials
Traditional
- Regular-Expressions.info - Covers numerous regex flavors.
- The Modern JavaScript Tutorial: Regular expressions - tutorial/en.javascript.info)] - Guide to using regexes in JavaScript.
- others
- RexEgg - Detailed tutorial with advanced topics.
- learnbyexample - Ebooks on regexes (JavaScript, Python, Ruby) and command line text processing.
- Regular Expressions for Regular Folk - for-regular-folk)] - Visual, example-based ebook for beginners.
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
With interactive exercises
- RegexLearn - Interactive tutorial and practice problems.
- RegexOne - Interactive tutorial and practice problems.
Visualizers
- Regex Vis - 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 - nodes)] - Graphical editor with visual hierarchy. Flavor: JavaScript.
- Debuggex - Create railroad diagrams. Flavors: JavaScript, PCRE, Python.
- Regexper - static)] - Create railroad diagrams. Flavor: JavaScript.