871 lines
38 KiB
HTML
871 lines
38 KiB
HTML
<!--lint ignore awesome-heading-->
|
||
<div data-align="center">
|
||
<p><a href="https://github.com/slevithan/awesome-regex"><img
|
||
src="media/awesome-regex-banner.svg" alt="Awesome Regex" /></a></p>
|
||
<p><a href="https://awesome.re"><img
|
||
src="https://awesome.re/badge-flat2.svg" alt="Awesome" /></a>
|
||
<sup>Shortcut URL: <a
|
||
href="https://regex.cool/"><code>regex.cool</code></a></sup></p>
|
||
</div>
|
||
<p>Awesome Regex curates the best regular expression tools, tutorials,
|
||
libraries, and other resources, covering all major regex flavors.</p>
|
||
<blockquote>
|
||
<p><a href="https://en.wikipedia.org/wiki/Regular_expression">Regular
|
||
expressions</a> (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.</p>
|
||
</blockquote>
|
||
<p>Contributions are welcome. Add links through pull requests (<a
|
||
href="CONTRIBUTING.md">guidelines</a>).</p>
|
||
<details>
|
||
<summary>
|
||
📖 <b>Glossary</b>
|
||
</summary>
|
||
<p><br></p>
|
||
<p><em>A brief glossary of regular expression terms as used in this
|
||
list.</em></p>
|
||
<ul>
|
||
<li><strong>Regex engine:</strong> Software that interprets and executes
|
||
regular expressions, either built into a programming language or as a
|
||
standalone library.</li>
|
||
<li><strong>Regex flavor:</strong> 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.
|
||
<ul>
|
||
<li>Ex: The “JavaScript” flavor is defined by the ECMAScript spec;
|
||
implemented by multiple engines (V8, etc.).</li>
|
||
<li>Ex: The “PCRE” flavor is the PCRE2 library, used by numerous
|
||
programming languages and tools.</li>
|
||
<li>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).</li>
|
||
</ul></li>
|
||
<li><strong>Non-backtracking engine:</strong> 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.</li>
|
||
</ul>
|
||
</details>
|
||
<h3 id="featured-resource">Featured resource</h3>
|
||
<p><a href="https://github.com/slevithan/regex"> <picture>
|
||
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/slevithan/regex@5.0.1/media/regex-logo-dark.svg">
|
||
<img alt="regex logo" height="100" align="right" src="https://cdn.jsdelivr.net/gh/slevithan/regex@5.0.1/media/regex-logo.svg">
|
||
</picture> </a></p>
|
||
<p><a href="https://github.com/slevithan/regex">Regex+</a> is a
|
||
lightweight JavaScript library for more readable, high-performance,
|
||
native JavaScript regexes with powerful features including free spacing,
|
||
atomic groups, possessive quantifiers, subroutines, subroutine
|
||
definition groups, and context-aware interpolation.</p>
|
||
<h2 id="contents">Contents</h2>
|
||
<ul>
|
||
<li><a href="#testers">Testers</a></li>
|
||
<li><a href="#syntax-free-regex-builders">Syntax-free regex
|
||
builders</a></li>
|
||
<li><a href="#visualizers">Visualizers</a></li>
|
||
<li><a href="#grep-like-tools">Grep-like tools</a></li>
|
||
<li><a href="#tutorials">Tutorials</a></li>
|
||
<li><a href="#regex-engines">Regex engines</a>
|
||
<ul>
|
||
<li><a href="#documentation">Documentation</a></li>
|
||
<li><a href="#source-code">Source code</a></li>
|
||
<li><a href="#flavor-differences">Flavor differences</a></li>
|
||
</ul></li>
|
||
<li><a href="#performance">Performance</a></li>
|
||
<li><a href="#collections-of-patterns">Collections of patterns</a></li>
|
||
<li><a href="#javascript-regex-libraries">JavaScript regex
|
||
libraries</a></li>
|
||
<li><a href="#javascript-regex-evolution">JavaScript regex
|
||
evolution</a></li>
|
||
<li><a href="#books">Books</a></li>
|
||
<li><a href="#articles">Articles</a></li>
|
||
<li><a href="#communities">Communities</a></li>
|
||
<li><a href="#miscellaneous">Miscellaneous</a></li>
|
||
</ul>
|
||
<h2 id="testers">Testers</h2>
|
||
<p><em>For building, testing, and playing with regexes.</em></p>
|
||
<ul>
|
||
<li><a href="https://regex101.com/">regex101</a> - <strong>Best free and
|
||
best web-based tester</strong>.
|
||
<ul>
|
||
<li>Flavors: Java, JavaScript, .NET, PCRE, RE2, Rust, and emulates
|
||
Python.</li>
|
||
<li>Includes regex debugger (PCRE only).</li>
|
||
</ul></li>
|
||
<li><a href="https://www.regexbuddy.com/">RegexBuddy</a>
|
||
(<img src="https://cdn.jsdelivr.net/gh/slevithan/awesome-regex/media/windows.svg" title="Windows" height="13">,
|
||
$40) - <strong>Best tester</strong>.
|
||
<ul>
|
||
<li>Flavors: Emulates hundreds of flavors/versions, with deep knowledge
|
||
of differences.</li>
|
||
<li>Includes regex debugger.</li>
|
||
</ul></li>
|
||
<li><a href="https://regexr.com/">RegExr</a> [<a
|
||
href="https://github.com/gskinner/regexr/"><em>GitHub</em></a>] -
|
||
<strong>Best open source tester</strong>.
|
||
<ul>
|
||
<li>Flavors: JavaScript, PCRE.</li>
|
||
<li>Languages: 🇺🇸, 🇨🇳 (<a href="https://regexr-cn.com/">fork</a>).</li>
|
||
</ul></li>
|
||
<li><a href="https://regexlearn.com/playground">RegexLearn</a> [<a
|
||
href="https://github.com/aykutkardas/regexlearn.com/blob/develop/src/pages/%5Blang%5D/playground.tsx"><em>GitHub</em></a>]
|
||
- <strong>Best multilingual tester</strong> (JavaScript).
|
||
<ul>
|
||
<li>Languages: 🇺🇸, 🇹🇷, 🇷🇺, 🇪🇸, 🇨🇳, 🇩🇪, 🇺🇦, 🇫🇷, 🇵🇱, 🇰🇷, 🇧🇷, 🇨🇿, 🇬🇪.</li>
|
||
</ul></li>
|
||
<li><a href="https://regexplained.com/">regexplained</a> [<a
|
||
href="https://github.com/LeaVerou/regexplained"><em>GitHub</em></a>] -
|
||
<strong>Best tester for presentations</strong> (JavaScript).</li>
|
||
</ul>
|
||
<details>
|
||
<summary>
|
||
✳️ <b>Notable mentions</b>
|
||
</summary>
|
||
<p><br></p>
|
||
<p><strong>Command line</strong></p>
|
||
<ul>
|
||
<li><a
|
||
href="https://pcre2project.github.io/pcre2/doc/pcre2test/">pcre2test</a>
|
||
- Includes regex debugger. Flavor: PCRE.</li>
|
||
<li><a
|
||
href="https://metacpan.org/dist/Regexp-Debugger/view/bin/rxrx">rxrx</a>
|
||
- Includes regex debugger (<a
|
||
href="https://www.youtube.com/watch?v=zcSFIUiMgAs">video intro</a>).
|
||
Flavor: Perl.</li>
|
||
</ul>
|
||
<p><strong>By flavor</strong></p>
|
||
<ul>
|
||
<li>JavaScript: <a href="http://regviz.org/">RegViz</a>.</li>
|
||
<li>.NET: <a href="http://regexstorm.net/tester">Regex Storm</a> [<a
|
||
href="https://github.com/lonekorean/regex-storm"><em>GitHub</em></a>].</li>
|
||
<li>PCRE: <a href="https://www.phpliveregex.com/">PHP Live
|
||
Regex</a>.</li>
|
||
<li>Python: <a href="https://pythex.org/">Pythex</a>.</li>
|
||
<li>Ruby: <a href="https://rubular.com/">Rubular</a>.</li>
|
||
<li>sed: <a href="https://sed.js.org/">GNU sed REPL</a>.</li>
|
||
<li>Swift: <a href="https://swiftregex.com/">Swift Regex</a> [<a
|
||
href="https://github.com/swiftfiddle/swiftregex"><em>GitHub</em></a>] -
|
||
Includes regex debugger, DSL builder.</li>
|
||
</ul>
|
||
<p><strong>Multiple flavors</strong></p>
|
||
<ul>
|
||
<li><a href="https://extendsclass.com/regex-tester.html">CyrilEx</a> [<a
|
||
href="https://github.com/cyrilbois/cyrilex"><em>GitHub</em></a>] - Java,
|
||
JavaScript, MySQL, PHP, Python, Ruby.</li>
|
||
<li><a href="https://krillapps.com/patterns/">Patterns</a>
|
||
(<img src="https://cdn.jsdelivr.net/gh/slevithan/awesome-regex/media/macos.svg" title="macOS" height="13">,
|
||
$3) - Bash, Emacs, grep, Java, Oniguruma, PCRE, POSIX BRE, POSIX ERE,
|
||
Ruby, sed.</li>
|
||
<li><a href="https://www.regexplanet.com/">RegexPlanet</a> [<a
|
||
href="https://github.com/regexplanet"><em>GitHub</em></a>] - Go, Java,
|
||
JavaScript (Bun, Deno, Node.js), .NET, Perl, PHP, PostgreSQL, Python,
|
||
Ruby, Rust, Swift, Tcl, XRegExp.</li>
|
||
</ul>
|
||
</details>
|
||
<h2 id="syntax-free-regex-builders">Syntax-free regex builders</h2>
|
||
<p><em>Build regexes without writing regex syntax or code.</em></p>
|
||
<ul>
|
||
<li><a href="https://chat.openai.com/">ChatGPT</a> (and other LLMs) -
|
||
Ex: <em>“create a regex that matches <code>X</code> and explain it step
|
||
by step”</em>.</li>
|
||
<li><a href="https://www.regexmagic.com/">RegexMagic</a>
|
||
(<img src="https://cdn.jsdelivr.net/gh/slevithan/awesome-regex/media/windows.svg" title="Windows" height="13">,
|
||
$40) - Generate regexes using samples and rules.
|
||
<ul>
|
||
<li>Flavors: Emulates hundreds of flavors/versions.</li>
|
||
</ul></li>
|
||
</ul>
|
||
<details>
|
||
<summary>
|
||
✳️ <b>Notable mentions</b>
|
||
</summary>
|
||
<p><br></p>
|
||
<ul>
|
||
<li><a href="https://regex-generator.olafneumann.org/">Regex
|
||
Generator</a> [<a
|
||
href="https://github.com/noxone/regex-generator"><em>GitHub</em></a>] -
|
||
Generate simple regexes from a sample text.</li>
|
||
<li><a href="https://regex.ai/">Regex.ai</a> - Mark samples in a text
|
||
and use AI to generate potential regexes.</li>
|
||
</ul>
|
||
</details>
|
||
<h2 id="visualizers">Visualizers</h2>
|
||
<p><em>Visualize how your regular expressions are structured or
|
||
operate.</em></p>
|
||
<ul>
|
||
<li><a href="https://regex-vis.com/">Regex Vis</a> [<a
|
||
href="https://github.com/Bowen7/regex-vis"><em>GitHub</em></a>] - Create
|
||
railroad diagrams, with visual editor. Flavor: JavaScript.
|
||
<ul>
|
||
<li>Languages: 🇺🇸, 🇨🇳.</li>
|
||
</ul></li>
|
||
<li><a href="https://jex.im/regulex/">Regulex</a> [<a
|
||
href="https://github.com/CJex/regulex"><em>GitHub</em></a>] - Create
|
||
railroad diagrams. Flavor: JavaScript.</li>
|
||
<li><a href="https://www.nodexr.net/">Nodexr</a> [<a
|
||
href="https://github.com/Jcparkyn/nodexr"><em>GitHub</em></a>] -
|
||
Graphical editor with visual hierarchy. Flavor: .NET.</li>
|
||
</ul>
|
||
<details>
|
||
<summary>
|
||
✳️ <b>Notable mentions</b>
|
||
</summary>
|
||
<p><br></p>
|
||
<ul>
|
||
<li><a href="https://johannesvollmer.com/regex-nodes/">Regex Nodes</a>
|
||
[<a
|
||
href="https://github.com/johannesvollmer/regex-nodes"><em>GitHub</em></a>]
|
||
- Graphical editor with visual hierarchy. Flavor: JavaScript.</li>
|
||
<li><a href="https://www.debuggex.com/">Debuggex</a> - Create railroad
|
||
diagrams. Flavors: JavaScript, PCRE, Python.</li>
|
||
<li><a href="https://regexper.com/">Regexper</a> [<a
|
||
href="https://gitlab.com/javallone/regexper-static"><em>GitLab</em></a>]
|
||
- Create railroad diagrams. Flavor: JavaScript.</li>
|
||
</ul>
|
||
</details>
|
||
<h2 id="grep-like-tools">Grep-like tools</h2>
|
||
<p><em>Search and replace through files.</em></p>
|
||
<h3 id="command-line">Command line</h3>
|
||
<ul>
|
||
<li><a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> - Better
|
||
and faster grep. Recursively searches directories while respecting
|
||
gitignore rules and skipping hidden/binary files.
|
||
<ul>
|
||
<li>Flavors: Rust (default), PCRE.</li>
|
||
</ul></li>
|
||
<li><a href="https://github.com/yaa110/nomino">nomino</a> - Rename files
|
||
uses regexes.
|
||
<ul>
|
||
<li>Flavor: Rust.</li>
|
||
</ul></li>
|
||
</ul>
|
||
<p>➕ <strong>See also:</strong> <a
|
||
href="https://beyondgrep.com/feature-comparison/">Feature comparison of
|
||
grep-like tools</a>.</p>
|
||
<h3 id="gui">GUI</h3>
|
||
<ul>
|
||
<li><a href="https://www.abareplace.com/">Aba Search and Replace</a>
|
||
(<img src="https://cdn.jsdelivr.net/gh/slevithan/awesome-regex/media/windows.svg" title="Windows" height="13">,
|
||
$30) - Displays matches as you type.</li>
|
||
<li><a href="https://www.powergrep.com/">PowerGREP</a>
|
||
(<img src="https://cdn.jsdelivr.net/gh/slevithan/awesome-regex/media/windows.svg" title="Windows" height="13">,
|
||
$159) - Can search through archives, binary files, PDFs, docs/sheets,
|
||
emails, etc., via its GUI or the command line.
|
||
<ul>
|
||
<li>Flavors: Emulates hundreds of flavors/versions.</li>
|
||
</ul></li>
|
||
<li><a href="https://github.com/microsoft/PowerToys">PowerRename</a>
|
||
(<img src="https://cdn.jsdelivr.net/gh/slevithan/awesome-regex/media/windows.svg" title="Windows" height="13">)
|
||
- Rename files using regexes.</li>
|
||
</ul>
|
||
<h2 id="tutorials">Tutorials</h2>
|
||
<p><em>Learn how to use regular expressions.</em></p>
|
||
<h3 id="traditional">Traditional</h3>
|
||
<ul>
|
||
<li><a
|
||
href="https://www.regular-expressions.info/">Regular-Expressions.info</a>
|
||
- Covers numerous regex flavors.</li>
|
||
<li><a href="https://javascript.info/regular-expressions">The Modern
|
||
JavaScript Tutorial: Regular expressions</a> [<a
|
||
href="https://github.com/javascript-tutorial/en.javascript.info"><em>GitHub</em></a>]
|
||
- Guide to using regexes in JavaScript.
|
||
<ul>
|
||
<li>Languages: 🇺🇸, 🇪🇸, 🇫🇷, 🇮🇹, 🇯🇵, 🇷🇺, 🇺🇦, 🇨🇳 (partial for <a
|
||
href="https://javascript.info/translate">others</a>).</li>
|
||
</ul></li>
|
||
</ul>
|
||
<details>
|
||
<summary>
|
||
✳️ <b>Notable mentions</b>
|
||
</summary>
|
||
<p><br></p>
|
||
<ul>
|
||
<li><a href="https://rexegg.com/">RexEgg</a> - Detailed tutorial with
|
||
advanced topics.</li>
|
||
<li><a href="https://learnbyexample.github.io/books/">learnbyexample</a>
|
||
[<a href="https://github.com/learnbyexample"><em>GitHub</em></a>] -
|
||
Ebooks on regexes (<a
|
||
href="https://learnbyexample.github.io/learn_js_regexp/">JavaScript</a>,
|
||
<a
|
||
href="https://learnbyexample.github.io/py_regular_expressions/">Python</a>,
|
||
<a href="https://learnbyexample.github.io/Ruby_Regexp/">Ruby</a>) and
|
||
command line text processing.</li>
|
||
<li><a href="https://refrf.dev/">Regular Expressions for Regular
|
||
Folk</a> [<a
|
||
href="https://github.com/shreyasminocha/regex-for-regular-folk"><em>GitHub</em></a>]
|
||
- Visual, example-based ebook for beginners.</li>
|
||
</ul>
|
||
</details>
|
||
<h3 id="with-interactive-exercises">With interactive exercises</h3>
|
||
<ul>
|
||
<li><a href="https://regexlearn.com/">RegexLearn</a> [<a
|
||
href="https://github.com/aykutkardas/regexlearn.com"><em>GitHub</em></a>]
|
||
- Interactive tutorial and practice problems.
|
||
<ul>
|
||
<li>Languages: 🇺🇸, 🇹🇷, 🇷🇺, 🇪🇸, 🇨🇳, 🇩🇪, 🇺🇦, 🇫🇷, 🇵🇱, 🇰🇷, 🇧🇷, 🇨🇿, 🇬🇪.</li>
|
||
</ul></li>
|
||
<li><a href="https://regexone.com/">RegexOne</a> - Interactive tutorial
|
||
and practice problems.</li>
|
||
</ul>
|
||
<h3 id="videos">Videos</h3>
|
||
<ul>
|
||
<li><a
|
||
href="https://www.youtube.com/watch?v=M7vDtxaD7ZU"><em>Demystifying
|
||
Regular Expressions</em></a> - Great presentation for beginners, by Lea
|
||
Verou at HolyJS 2017 (1hr 12m).</li>
|
||
<li><a href="https://www.youtube.com/watch?v=rhzKDrUiJVk"><em>Learn
|
||
Regular Expressions In 20 Minutes</em></a> - Live syntax walkthrough in
|
||
a regex tester, by Kyle Cook.</li>
|
||
<li>Many options for video courses are available on <a
|
||
href="https://www.udemy.com/topic/regular-expressions/">Udemy</a>
|
||
($).</li>
|
||
</ul>
|
||
<h2 id="regex-engines">Regex engines</h2>
|
||
<p><em>Major regex implementations, built into programming languages or
|
||
as standalone libraries.</em></p>
|
||
<h3 id="documentation">Documentation</h3>
|
||
<p><em>Official regex references and guides.</em></p>
|
||
<h4 id="regex-flavors">Regex flavors</h4>
|
||
<ul>
|
||
<li>Boost.Regex: <a href="https://boost.org/libs/regex">Manual</a>.</li>
|
||
<li>C++: <a href="https://en.cppreference.com/w/cpp/regex">Regular
|
||
expressions library</a>.</li>
|
||
<li>Hyperscan: <a
|
||
href="https://www.hyperscan.io/">Introduction</a>.</li>
|
||
<li>ICU: <a
|
||
href="https://unicode-org.github.io/icu/userguide/strings/regexp.html">Regular
|
||
Expressions</a>.</li>
|
||
<li>Java: <a
|
||
href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/regex/Pattern.html">Pattern</a>,
|
||
<a
|
||
href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/regex/package-summary.html">API</a>.</li>
|
||
<li>JavaScript: <a
|
||
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp">RegExp</a>,
|
||
<a
|
||
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions">Reference</a>,
|
||
<a
|
||
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions">Guide</a>,
|
||
<a
|
||
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Cheatsheet">Cheatsheet</a>.</li>
|
||
<li>.NET: <a
|
||
href="https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expressions">Overview</a>,
|
||
<a
|
||
href="https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference">Language</a>,
|
||
<a
|
||
href="https://learn.microsoft.com/en-us/dotnet/api/system.text.regularexpressions">API</a>.</li>
|
||
<li>Onigmo: <a
|
||
href="https://github.com/k-takata/Onigmo/blob/master/doc/RE">RE</a>.</li>
|
||
<li>Oniguruma: <a
|
||
href="https://github.com/kkos/oniguruma/blob/master/doc/RE">RE</a>.</li>
|
||
<li>PCRE2: <a
|
||
href="https://pcre2project.github.io/pcre2/doc/pcre2pattern/">Pattern</a>,
|
||
<a href="https://pcre2project.github.io/pcre2/doc/">API</a>.</li>
|
||
<li>Perl: <a href="https://perldoc.perl.org/perlre">Syntax</a>, <a
|
||
href="https://perldoc.perl.org/perlretut">Tutorial</a>, <a
|
||
href="https://perldoc.perl.org/perlrequick">Quick Start</a>.</li>
|
||
<li>Python: <a
|
||
href="https://docs.python.org/library/re.html">re</a>.</li>
|
||
<li>RE2: <a
|
||
href="https://github.com/google/re2/wiki/Syntax">Syntax</a>.</li>
|
||
<li>Rust: <a href="https://docs.rs/regex">regex</a> - See also: <a
|
||
href="https://docs.rs/regex-lite">regex-lite</a>.</li>
|
||
<li>Swift: <a
|
||
href="https://developer.apple.com/documentation/swift/regex/">Regex</a>
|
||
- See also: <a
|
||
href="https://developer.apple.com/documentation/regexbuilder">RegexBuilder</a>,
|
||
<a
|
||
href="https://developer.apple.com/documentation/foundation/nsregularexpression">NSRegularExpression</a>.</li>
|
||
</ul>
|
||
<p>ℹ️ Raku (formerly Perl 6) reimagines regexes. See: <a
|
||
href="https://docs.raku.org/language/grammars">Grammars</a> (<a
|
||
href="https://docs.raku.org/language/grammar_tutorial">tutorial</a>), <a
|
||
href="https://docs.raku.org/language/regexes">Regexes</a> (<a
|
||
href="https://docs.raku.org/language/regexes-best-practices">best
|
||
practices</a>).</p>
|
||
<h4 id="without-own-flavor">Without own flavor</h4>
|
||
<ul>
|
||
<li>Go: <a href="https://pkg.go.dev/regexp">regexp</a> - Flavor:
|
||
RE2.</li>
|
||
<li>MySQL: <a
|
||
href="https://dev.mysql.com/doc/refman/en/regexp.html">Regular
|
||
Expressions</a> - Flavor: ICU.</li>
|
||
<li>PHP: <a href="https://www.php.net/manual/en/book.pcre.php">Regular
|
||
Expressions</a> - Flavor: PCRE.</li>
|
||
<li>Ruby: <a
|
||
href="https://docs.ruby-lang.org/en/master/Regexp.html">Regexp</a> -
|
||
Flavor: Onigmo.</li>
|
||
</ul>
|
||
<h3 id="source-code">Source code</h3>
|
||
<p><em>Read or contribute to the code behind major regex
|
||
implementations.</em></p>
|
||
<ul>
|
||
<li><a href="https://github.com/boostorg/regex">Boost.Regex</a> -
|
||
Popular C++ regex library.</li>
|
||
<li><a href="https://github.com/intel/hyperscan">Hyperscan</a> - Intel’s
|
||
high-performance library, used for <a
|
||
href="https://en.wikipedia.org/wiki/Deep_packet_inspection">DPI</a>.</li>
|
||
<li><a
|
||
href="https://github.com/unicode-org/icu/blob/main/icu4c/source/i18n/regexcmp.cpp">ICU</a>
|
||
- Unicode org’s package with full Unicode support.</li>
|
||
<li><a
|
||
href="https://github.com/openjdk/jdk/tree/master/src/java.base/share/classes/java/util/regex">Java:
|
||
java.util.regex</a> - JDK standard regexes.</li>
|
||
<li>JavaScript:
|
||
<ul>
|
||
<li><a
|
||
href="https://github.com/WebKit/WebKit/blob/main/Source/JavaScriptCore/runtime/RegExp.cpp">JavaScriptCore:
|
||
RegExp</a> - Regex engine used by Safari.</li>
|
||
<li><a href="https://github.com/v8/v8/tree/main/src/regexp">V8:
|
||
Irregexp</a> - Regex engine used by Chrome, Edge, <a
|
||
href="https://hacks.mozilla.org/2020/06/a-new-regexp-engine-in-spidermonkey/">Firefox</a>,
|
||
etc.</li>
|
||
</ul></li>
|
||
<li><a
|
||
href="https://github.com/dotnet/runtime/tree/main/src/libraries/System.Text.RegularExpressions">.NET:
|
||
System.Text.RegularExpressions</a> - Shared by all .NET languages (C#,
|
||
VB, etc.).</li>
|
||
<li><a href="https://github.com/k-takata/Onigmo">Onigmo</a> - Forked
|
||
from Oniguruma. Used by Ruby 2.0+.</li>
|
||
<li><a href="https://github.com/kkos/oniguruma">Oniguruma</a> - Popular
|
||
C regex library used by Ruby 1.9, TextMate grammars, etc.</li>
|
||
<li><a href="https://github.com/PCRE2Project/pcre2">PCRE2</a> - Popular
|
||
C regex library used by PHP, R, etc.</li>
|
||
<li><a href="https://github.com/Perl/perl5/blob/blead/regexp.h">Perl</a>
|
||
- See <a href="https://perldoc.perl.org/perlreguts">perlreguts</a>.</li>
|
||
<li><a href="https://github.com/python/cpython/tree/main/Lib/re">Python:
|
||
re</a> and <a href="https://github.com/mrabarnett/mrab-regex">regex</a>
|
||
- Standard and extended regex libraries.</li>
|
||
<li><a href="https://github.com/google/re2">RE2</a> - Popular C++ regex
|
||
library used by Go, etc. Non-backtracking engine.</li>
|
||
<li><a href="https://github.com/rust-lang/regex">Rust: regex</a> -
|
||
Non-backtracking engine.</li>
|
||
</ul>
|
||
<h3 id="flavor-differences">Flavor differences</h3>
|
||
<p><em>Syntax and behavior differences between regex flavors.</em></p>
|
||
<ul>
|
||
<li>Ron Buckton: <a
|
||
href="https://rbuckton.github.io/regexp-features/">Regular Expression
|
||
Feature Comparisons</a> [<a
|
||
href="https://github.com/rbuckton/regexp-features"><em>GitHub</em></a>].</li>
|
||
<li>Regular-Expressions.info: <a
|
||
href="https://www.regular-expressions.info/tools.html">Tools &
|
||
Languages</a>.</li>
|
||
<li>Steven Levithan: <a
|
||
href="https://xregexp.com/syntax/named_capture_comparison/">Named
|
||
capture</a>, <a
|
||
href="https://stevenlevithan.com/regex/tests/lookbehind.html">Lookbehind</a>.</li>
|
||
<li>Wikipedia: <a
|
||
href="https://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines">Comparison
|
||
of regular expression engines</a>.</li>
|
||
</ul>
|
||
<h2 id="performance">Performance</h2>
|
||
<p><em>Pattern and engine performance, benchmarks, and <a
|
||
href="https://en.wikipedia.org/wiki/ReDoS">ReDoS</a>
|
||
prevention.</em></p>
|
||
<h3 id="crafting-efficient-regexes">Crafting efficient regexes</h3>
|
||
<ul>
|
||
<li><a
|
||
href="https://www.regular-expressions.info/catastrophic.html">Runaway
|
||
Regular Expressions: Catastrophic Backtracking</a> - Exploration and
|
||
solutions for superlinear backtracking.</li>
|
||
<li><a href="https://www.amazon.com/dp/059680279X/?tag=slev-20">Book:
|
||
High Performance JavaScript</a> (2010) - <em>Chapter 5: Strings and
|
||
Regular Expressions</em>.</li>
|
||
<li><a
|
||
href="https://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/?tag=slev-20">Book:
|
||
Mastering Regular Expressions, 3rd Edition</a> (2006) - <em>Chapter 6:
|
||
Crafting an Efficient Expression</em>.</li>
|
||
<li><a
|
||
href="https://blog.stevenlevithan.com/archives/greedy-lazy-performance">Performance
|
||
of Greedy vs. Lazy Regex Quantifiers</a> - Illustrates the mechanics of
|
||
backtracking.</li>
|
||
</ul>
|
||
<p>ℹ️ With backtracking engines, how you craft a regex can affect how
|
||
fast it finds matches or reports failures.</p>
|
||
<details>
|
||
<summary>
|
||
✳️ <b>Notable mentions</b>
|
||
</summary>
|
||
<p><br></p>
|
||
<ul>
|
||
<li><a
|
||
href="https://medium.com/textmaster-engineering/performance-of-regular-expressions-81371f569698">Performance
|
||
of Regular Expressions</a> - On backtracking performance, with detailed
|
||
examples.</li>
|
||
</ul>
|
||
</details>
|
||
<h3 id="regex-engine-optimization">Regex engine optimization</h3>
|
||
<ul>
|
||
<li><a href="https://swtch.com/~rsc/regexp/regexp1.html">Regular
|
||
Expression Matching Can Be Simple And Fast</a> - On non-backtracking
|
||
engines. A <a href="https://swtch.com/~rsc/regexp/regexp3.html">follow
|
||
up</a> includes comparisons of RE2 and PCRE performance.</li>
|
||
<li><a
|
||
href="https://devblogs.microsoft.com/dotnet/regular-expression-improvements-in-dotnet-7/">Regular
|
||
Expression Improvements in .NET 7</a> and <a
|
||
href="https://devblogs.microsoft.com/dotnet/regex-performance-improvements-in-net-5/">.NET
|
||
5</a> - Includes detailed explanations of performance
|
||
optimizations.</li>
|
||
<li><a href="https://blog.burntsushi.net/ripgrep/">ripgrep is faster
|
||
than {grep, …}</a> - Includes details about what makes ripgrep and
|
||
Rust’s <code>regex</code> fast.</li>
|
||
</ul>
|
||
<h3 id="benchmarking">Benchmarking</h3>
|
||
<ul>
|
||
<li>Cross-engine benchmarking libraries: <a
|
||
href="https://github.com/BurntSushi/rebar">rebar</a>, <a
|
||
href="https://github.com/mariomka/regex-benchmark">regex-benchmark</a>.</li>
|
||
<li><a
|
||
href="https://www.boost.org/doc/libs/release/libs/regex/doc/html/boost_regex/background/performance.html">Boost.Regex:
|
||
Performance</a> - Compares Boost, C++ <code>std::regex</code>, and
|
||
others.</li>
|
||
</ul>
|
||
<h3 id="redos-checkers">ReDoS checkers</h3>
|
||
<ul>
|
||
<li><a href="https://regex.rip/">regex.rip</a> - Test a regex for ReDoS
|
||
vulnerability.</li>
|
||
<li><a href="https://github.com/makenowjust-labs/recheck">recheck</a>
|
||
[<a
|
||
href="https://makenowjust-labs.github.io/recheck/"><em>home</em></a>] -
|
||
JavaScript and Scala library for detecting ReDoS vulnerability. Can be
|
||
used as an ESLint plugin.</li>
|
||
<li><a
|
||
href="https://github.com/davisjam/vuln-regex-detector">vuln-regex-detector</a>
|
||
- Perl library for detecting ReDoS vulnerability.</li>
|
||
</ul>
|
||
<p>⚠️ These tools have limitations on supported syntax.</p>
|
||
<h2 id="collections-of-patterns">Collections of patterns</h2>
|
||
<p><em>Prewritten regexes for specific tasks.</em></p>
|
||
<ul>
|
||
<li><a
|
||
href="https://www.amazon.com/Regular-Expressions-Cookbook-Solutions-Programming/dp/1449319432/?tag=slev-20">Book:
|
||
Regular Expressions Cookbook, 2nd Edition</a> (2012) - High-quality
|
||
solutions with detailed explanations.
|
||
<ul>
|
||
<li>Flavors: Java, JavaScript, .NET, PCRE, Perl, Python, Ruby,
|
||
XRegExp.</li>
|
||
</ul></li>
|
||
<li><a href="https://rgxdb.com/">Regex DB</a> - Solutions include basic
|
||
descriptions and examples of matching and non-matching text.</li>
|
||
</ul>
|
||
<details>
|
||
<summary>
|
||
⚠️ <b>Word of warning</b>
|
||
</summary>
|
||
<p><br></p>
|
||
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.
|
||
</details>
|
||
<h2 id="javascript-regex-libraries">JavaScript regex libraries</h2>
|
||
<p><em>Open source JavaScript libraries for advanced regex use and
|
||
processing.</em></p>
|
||
<h3 id="alternative-regex-builders-and-engines">Alternative regex
|
||
builders and engines</h3>
|
||
<ul>
|
||
<li><a href="https://github.com/slevithan/regex">Regex+</a> - A template
|
||
tag for extended, readable, high-performance JavaScript regexes.</li>
|
||
<li><a
|
||
href="https://github.com/slevithan/oniguruma-to-es">Oniguruma-To-ES</a>
|
||
- Convert Oniguruma patterns to native JavaScript regexes.</li>
|
||
<li><a href="https://github.com/slevithan/xregexp">XRegExp</a> [<a
|
||
href="https://xregexp.com/"><em>home</em></a>] - Extended regex syntax,
|
||
flags, and utils; useful for backcompat.</li>
|
||
<li><a
|
||
href="https://github.com/nurulc/incr-regex-package">incr-regex-package</a>
|
||
- Partial/incremental matching, used by <a
|
||
href="https://github.com/nurulc/react-rxinput">react-rxinput</a> for
|
||
input validation with a regex mask.</li>
|
||
<li>Use other engines via WASM bindings: <a
|
||
href="https://github.com/uhop/node-re2">node-re2</a> (RE2), <a
|
||
href="https://github.com/2fd/rregex">rregex</a> (Rust’s
|
||
<code>regex</code>), <a
|
||
href="https://github.com/microsoft/vscode-oniguruma">vscode-oniguruma</a>
|
||
(Oniguruma).</li>
|
||
</ul>
|
||
<h3 id="abstracted-regex-syntax">Abstracted regex syntax</h3>
|
||
<ul>
|
||
<li><a href="https://github.com/yyytcool/rexx">Rexx</a> - A template tag
|
||
that uses structured syntax with variables and comments.</li>
|
||
<li><a href="https://github.com/yoav-lavi/melody">Melody</a> [<a
|
||
href="https://yoav-lavi.github.io/melody/book/"><em>docs</em></a>] - A
|
||
language that compiles to regexes.</li>
|
||
<li>Compose with functions: <a
|
||
href="https://github.com/compose-regexp/compose-regexp.js">compose-regexp.js</a>,
|
||
<a
|
||
href="https://github.com/VerbalExpressions/JSVerbalExpressions">VerbalExpressions</a>
|
||
(implementations for <a href="https://verbalexpressions.github.io/">many
|
||
languages</a>), <a
|
||
href="https://github.com/unjs/magic-regexp">magic-regexp</a> [<a
|
||
href="https://regexp.dev/"><em>home</em></a>], <a
|
||
href="https://github.com/francisrstokes/super-expressive">Super
|
||
Expressive</a> [<a
|
||
href="https://nartc.github.io/ng-super-expressive/"><em>playground</em></a>].</li>
|
||
</ul>
|
||
<h3 id="regex-processors">Regex processors</h3>
|
||
<ul>
|
||
<li>AST builders: <a
|
||
href="https://github.com/eslint-community/regexpp">regexpp</a> (used by
|
||
ESLint), <a
|
||
href="https://github.com/DmitrySoshnikov/regexp-tree">regexp-tree</a>
|
||
(includes optimizer, etc.), <a
|
||
href="https://github.com/jviereck/regjsparser">regjsparser</a>/<a
|
||
href="https://github.com/bnjmnt4n/regjsgen">regjsgen</a>.
|
||
<ul>
|
||
<li>AST explorers: <a
|
||
href="https://astexplorer.net/#/gist/56d33dc28d07c7f57bdf5ca0f4061320/c6b67a829334151af01ba55960c653e4462df437">AST
|
||
Explorer: RegExp</a>, <a
|
||
href="https://leaysgur.github.io/js-regexp-ast-viewer/">JS RegExp AST
|
||
Viewer</a>.</li>
|
||
<li><a
|
||
href="https://github.com/RunDevelopment/regexp-ast-analysis">regexp-ast-analysis</a>
|
||
[<a
|
||
href="https://rundevelopment.github.io/regexp-ast-analysis/docs/latest/"><em>docs</em></a>]
|
||
- Analyze AST nodes produced by regexpp.</li>
|
||
</ul></li>
|
||
<li>Highlight regex syntax: <a
|
||
href="https://github.com/slevithan/regex-colorizer">Regex Colorizer</a>
|
||
[<a
|
||
href="https://slevithan.github.io/regex-colorizer/demo/"><em>home</em></a>],
|
||
<a href="https://github.com/xavierog/codemirror-mode-pcre">CodeMirror
|
||
PCRE mode</a>.</li>
|
||
<li>Find regex mistakes and improvements: <a
|
||
href="https://github.com/ota-meshi/eslint-plugin-regexp">eslint-plugin-regexp</a>
|
||
[<a
|
||
href="https://ota-meshi.github.io/eslint-plugin-regexp/"><em>home</em></a>],
|
||
<a
|
||
href="https://github.com/BrainMaestro/eslint-plugin-optimize-regex">eslint-plugin-optimize-regex</a>.</li>
|
||
<li>Generate strings that match a given regex: <a
|
||
href="https://github.com/fent/randexp.js">randexp.js</a>, <a
|
||
href="https://github.com/wimpyprogrammer/regex-to-strings">regex-to-strings</a>.</li>
|
||
<li>Generate a regex from given strings: <a
|
||
href="https://github.com/devongovett/regexgen">regexgen</a>.</li>
|
||
</ul>
|
||
<h2 id="javascript-regex-evolution">JavaScript regex evolution</h2>
|
||
<p><em>The history of improvements to regular expressions in the
|
||
JavaScript <a href="https://tc39.es/ecma262/multipage/">standard</a>.
|
||
Starting with ES2018, includes links to the TC39 proposals where
|
||
features were developed and discussed.</em></p>
|
||
<ul>
|
||
<li>ES3 (1999) introduced regular expressions.</li>
|
||
<li>ES5 (2009) fixed unintuitive behavior by creating a new object every
|
||
time regex literals are evaluated [<a
|
||
href="https://whereswalden.com/2010/01/15/more-es5-incompatible-changes-regular-expressions-now-evaluate-to-a-new-object-not-the-same-object-each-time-theyre-encountered/"><em>explainer</em></a>],
|
||
and allowed regex literals to use unescaped forward slashes within
|
||
character classes (<code>/[/]/</code>).</li>
|
||
<li>ES6/ES2015 added: [<a
|
||
href="https://2ality.com/2015/07/regexp-es6.html"><em>explainer</em></a>]
|
||
<ul>
|
||
<li>Flag <code>y</code> (<code>sticky</code>), which anchors matches to
|
||
<code>lastIndex</code>.</li>
|
||
<li>Flag <code>u</code> (<code>unicode</code>) [<a
|
||
href="https://mathiasbynens.be/notes/es6-unicode-regex"><em>explainer</em></a>]
|
||
[<a href="https://github.com/tc39/ecma262/pull/525"><em>2016 spec
|
||
fix</em></a>], which adds Unicode code point escapes via
|
||
<code>\u{…}</code>, strict errors (for unreserved escapes, octal
|
||
escapes, quantified lookahead, and unescaped special characters in some
|
||
contexts), Unicode case-folding for flag <code>i</code>, and code point
|
||
matching (with impact on quantifiers, character classes, ranges, and
|
||
built-in sets).</li>
|
||
<li>Getter <code>RegExp.prototype.flags</code>, the ability to copy a
|
||
regex using <code>RegExp</code> (optionally with new flags), and support
|
||
for subclassing <code>RegExp</code> (along with
|
||
<code>RegExp.prototype[Symbol.match</code>/<code>replace</code>/<code>search</code>/<code>split]</code>
|
||
and <code>RegExp[Symbol.species]</code>).</li>
|
||
</ul></li>
|
||
<li>ES2018 added <a
|
||
href="https://github.com/tc39/proposal-regexp-dotall-flag">flag
|
||
<code>s</code></a> (<code>dotAll</code>), <a
|
||
href="https://github.com/tc39/proposal-regexp-lookbehind">lookbehind</a>,
|
||
<a href="https://github.com/tc39/proposal-regexp-named-groups">named
|
||
capture</a>, and <a
|
||
href="https://github.com/tc39/proposal-regexp-unicode-property-escapes">Unicode
|
||
properties</a> (via <code>\p{…}</code> and <code>\P{…}</code> which
|
||
require flag <code>u</code>; see <a
|
||
href="https://github.com/mathiasbynens/regexpu-core/blob/main/property-escapes.md">list</a>).</li>
|
||
<li>ES2020 added string method <a
|
||
href="https://github.com/tc39/proposal-string-matchall"><code>matchAll</code></a>
|
||
(which returns an iterator), plus
|
||
<code>RegExp.prototype[Symbol.matchAll]</code>.</li>
|
||
<li>ES2022 added <a
|
||
href="https://github.com/tc39/proposal-regexp-match-indices">flag
|
||
<code>d</code></a> (<code>hasIndices</code>), which provides start/end
|
||
indices for matched substrings.</li>
|
||
<li>ES2024 added <a
|
||
href="https://github.com/tc39/proposal-regexp-v-flag">flag
|
||
<code>v</code></a> (<code>unicodeSets</code>) [<a
|
||
href="https://v8.dev/features/regexp-v-flag"><em>explainer</em></a>] as
|
||
an upgrade to flag <code>u</code>, which adds a set of multicharacter
|
||
“properties of strings” to <code>\p{…}</code>, multicharacter elements
|
||
within character classes via <code>\p{…}</code> and
|
||
<code>\q{…|…}</code>, nested character classes, set operators
|
||
<code>[…--…]</code> and <code>[…&&…]</code>, and different
|
||
escaping rules within character classes. It also fixes case-insensitive
|
||
matching for <code>\p</code> and <code>\P</code> within negated
|
||
<code>[^…]</code>.</li>
|
||
</ul>
|
||
<blockquote>
|
||
Each edition from ES2019 to ES2023 added additional Unicode properties
|
||
that can be used via <code>\p{…}</code> and <code>\P{…}</code> (see <a
|
||
href="https://github.com/eslint-community/regexpp/blob/main/src/unicode/properties.ts">lists</a>).
|
||
ES2021 added string method <a
|
||
href="https://github.com/tc39/proposal-string-replaceall"><code>replaceAll</code></a>,
|
||
although, when given a regex, the only difference from ES3’s
|
||
<code>replace</code> is that it throws if not using flag <code>g</code>.
|
||
<details>
|
||
<summary>
|
||
➕ <b>See also</b>
|
||
</summary>
|
||
<p><br></p>
|
||
</blockquote>
|
||
<ul>
|
||
<li><a
|
||
href="https://www.smashingmagazine.com/2024/08/history-future-regular-expressions-javascript/"><em>Regexes
|
||
Got Good: The History And Future Of Regular Expressions In
|
||
JavaScript</em></a></li>
|
||
<li>Backcompat libraries: <a
|
||
href="https://github.com/mathiasbynens/regexpu">regexpu</a>, <a
|
||
href="https://github.com/mathiasbynens/regenerate">regenerate</a> (<a
|
||
href="https://github.com/mathiasbynens/regenerate-unicode-properties">Unicode
|
||
property sets</a>).</li>
|
||
<li>Chrome’s <code>l</code> (<code>linear</code>) regex flag, behind a
|
||
V8 flag [<a
|
||
href="https://v8.dev/blog/non-backtracking-regexp"><em>explainer</em></a>]
|
||
[<a
|
||
href="https://www.chromium.org/developers/how-tos/run-chromium-with-flags/"><em>how
|
||
to run</em></a>].</li>
|
||
<li><a href="https://caniuse.com/">Can I use</a> - Up-to-date browser
|
||
support tables for individual features.
|
||
</details></li>
|
||
</ul>
|
||
<details>
|
||
<summary>
|
||
🔮 <b>Future: Active proposals</b>
|
||
</summary>
|
||
<p><br></p>
|
||
<ul>
|
||
<li><a
|
||
href="https://github.com/tc39/proposal-duplicate-named-capturing-groups">Duplicate
|
||
named capturing groups</a> (2022) - Ex:
|
||
<code>(?<a>…)|(?<a>…)</code>.</li>
|
||
<li><a href="https://github.com/tc39/proposal-regexp-x-mode">Extended
|
||
mode and comments</a> (2021) - Flag <code>x</code>
|
||
(<code>extended</code>) with insignificant whitespace and line comments
|
||
(<code>#…</code>), plus inline comments via <code>(?#…)</code>.</li>
|
||
<li><a href="https://github.com/tc39/proposal-regexp-modifiers">Pattern
|
||
modifiers</a> (2021) - Ex: <code>(?ims:…)</code>,
|
||
<code>(?-ims:…)</code>, <code>(?i-ms:…)</code>.</li>
|
||
<li><a
|
||
href="https://github.com/tc39/proposal-regexp-atomic-operators">Atomic
|
||
operators</a> (2021) - Atomic groups via <code>(?>…)</code> and
|
||
possessive quantifiers (ex: <code>*+</code>, <code>++</code>).</li>
|
||
<li><a
|
||
href="https://github.com/tc39/proposal-regexp-buffer-boundaries">Buffer
|
||
boundaries</a> (2021) - Anchors <code>\A</code> and <code>\z</code>, not
|
||
affected by flag <code>m</code>.</li>
|
||
<li><a
|
||
href="https://github.com/tc39/proposal-regexp-r-escape">escape</a>
|
||
(2021) - Outside character classes, <code>\R</code> matches any line
|
||
terminator.</li>
|
||
<li><a
|
||
href="https://github.com/tc39/proposal-rm-builtin-subclassing">Restrict
|
||
subclassing support in built-ins</a> (2020) - Scaled back
|
||
<code>RegExp</code> subclassing.</li>
|
||
<li><a href="https://github.com/tc39/proposal-regex-escaping">RegExp
|
||
escaping</a> (2015) - <code>RegExp.escape</code>.</li>
|
||
<li><a
|
||
href="https://github.com/tc39/proposal-regexp-legacy-features">Legacy
|
||
RegExp features</a> (2015) - Standardization of legacy features.</li>
|
||
</ul>
|
||
</details>
|
||
<h2 id="books">Books</h2>
|
||
<p><em>A curated list of regex books.</em></p>
|
||
<ul>
|
||
<li><a
|
||
href="https://www.amazon.com/dp/1449319432/?tag=slev-20"><em>Regular
|
||
Expressions Cookbook, 2nd Edition</em></a> (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.
|
||
<ul>
|
||
<li>Flavors: Java, JavaScript, .NET, PCRE, Perl, Python, Ruby,
|
||
XRegExp.</li>
|
||
</ul></li>
|
||
<li><a
|
||
href="https://www.amazon.com/dp/0596528124/?tag=slev-20"><em>Mastering
|
||
Regular Expressions, 3rd Edition</em></a> (2006) by Jeffrey Friedl - A
|
||
computer science classic, best for people who already know the basics.
|
||
Includes good coverage of crafting efficient regexes.
|
||
<ul>
|
||
<li>Flavors: Dedicated chapters on Java, .NET, Perl, and PHP (PCRE),
|
||
with more limited coverage of Python, Tcl, command line tools, etc.</li>
|
||
</ul></li>
|
||
<li><a
|
||
href="https://www.amazon.com/dp/1449392687/?tag=slev-20"><em>Introducing
|
||
Regular Expressions</em></a> (2012) by Michael Fitzgerald - An intro for
|
||
programmers new to regular expressions that sticks to the basics.</li>
|
||
</ul>
|
||
<h2 id="articles">Articles</h2>
|
||
<p><em>A curated list of regex articles.</em></p>
|
||
<ul>
|
||
<li><a href="https://jasonhpriestley.com/regex"><em>The World’s Shortest
|
||
Regex Compiler?</em></a> and a <a
|
||
href="https://jasonhpriestley.com/regex-dfa">follow up</a> on
|
||
optimization - Introduction to writing a non-backtracking regex engine
|
||
(in JavaScript).</li>
|
||
<li><a
|
||
href="https://blog.stevenlevithan.com/archives/regex-legends"><em>Regex
|
||
Legends: The People Behind the Magic</em></a> - Influential people
|
||
behind the technology.</li>
|
||
<li><a
|
||
href="https://blog.stevenlevithan.com/archives/balancing-groups"><em>Fun
|
||
With .NET Regex Balancing Groups</em></a> - Advanced usage of a
|
||
.NET-only regex feature.</li>
|
||
</ul>
|
||
<h2 id="communities">Communities</h2>
|
||
<p><em>Discuss, assist, and get help with regular expressions.</em></p>
|
||
<ul>
|
||
<li><a href="https://www.reddit.com/r/regex/">Reddit: r/regex</a></li>
|
||
<li><a
|
||
href="https://stackoverflow.com/questions/tagged/regex?tab=Votes">Stack
|
||
Overflow: [regex]</a></li>
|
||
</ul>
|
||
<h2 id="miscellaneous">Miscellaneous</h2>
|
||
<p><em>Other interesting, fun, and useful stuff.</em></p>
|
||
<ul>
|
||
<li>Quiz: <a href="https://regex101.com/quiz">regex101 Regex Quiz</a> -
|
||
Requires sign-in.</li>
|
||
<li>Games: <a href="https://regexcrossword.com/">Regex Crossword</a>, <a
|
||
href="https://regexle.com/">regexle</a>, <a
|
||
href="https://thetypingoftheregex.com/">The Typing of the RegEX</a>, <a
|
||
href="https://codepip.com/games/regex-machina/">Regex Machina</a>
|
||
($).</li>
|
||
<li>Comics: <a href="https://xkcd.com/208/">xkcd</a>, <a
|
||
href="https://twitter.com/garabatokid/status/1147063121678389253">Garabato
|
||
Kid</a>.</li>
|
||
</ul>
|
||
<h2 id="about">About</h2>
|
||
<p>Awesome Regex was created by <a
|
||
href="https://github.com/slevithan">Steven Levithan</a> and <a
|
||
href="https://github.com/slevithan/awesome-regex/graphs/contributors">contributors</a>.</p>
|
||
<h3 id="sponsors-and-backers">Sponsors and backers</h3>
|
||
<p><a
|
||
href="https://github.com/brc-dd"><img src="https://github.com/brc-dd.png" width="40" height="40"></a>
|
||
<a
|
||
href="https://github.com/roboflow"><img src="https://github.com/roboflow.png" width="40" height="40"></a></p>
|
||
<h3 id="past-sponsors">Past sponsors</h3>
|
||
<p><a
|
||
href="https://github.com/antfu"><img src="https://github.com/antfu.png" width="40" height="40"></a></p>
|
||
<p>If you want to support this project, I’d love your help by
|
||
contributing improvements, sharing it with others, or <a
|
||
href="https://github.com/sponsors/slevithan">sponsoring</a> ongoing
|
||
development.</p>
|
||
<p>© 2024–present. CC BY 4.0.</p>
|
||
<p><a href="https://github.com/slevithan/awesome-regex">regex.md
|
||
Github</a></p>
|