Files
awesome-awesomeness/readmes/regex.md2
2025-07-18 23:13:11 +02:00

228 lines
17 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
Title: Awesome Regex
Description: A curated list of amazingly awesome regex resources.
Author: aloisdg
-->
# Awesome Regex
[![Awesome](https://awesome.re/badge.svg)](https://awesome.re)
[![Main workflow](https://github.com/aloisdg/awesome-regex/workflows/Main%20workflow/badge.svg)](https://github.com/aloisdg/awesome-regex/actions)
## Introduction
A curated collection of awesome Regex libraries, tools, frameworks and software. The goal is to build a categorized community-driven collection of very well-known resources.
Inspired by [awesome-dotnet](https://github.com/quozd/awesome-dotnet), [awesome-ruby](https://github.com/markets/awesome-ruby), [awesome-awesomeness](https://github.com/bayandin/awesome-awesomeness) and the whole `awesome-*` trend on GitHub. Thank you [Reddit](http://www.reddit.com/r/regex), [Hacker News](https://news.ycombinator.com/item?id=9581225) and [Stack Overflow](http://stackoverflow.com/tags/regex/info) for the help.
Sharing, suggestions and contributions are always welcome! Please take a look at the [contribution guidelines and quality standard](https://github.com/aloisdg/awesome-regex/blob/master/CONTRIBUTING.md) first. Thanks to all contributors, you're awesome and wouldn't be possible without you!
## Contents
- [Documentation](#documentation)
- [Prototyping and Testing](#prototyping-and-testing)
- [Generators](#generators)
- [Security](#security)
- [Learning](#learning)
- [Libraries](#libraries)
- [Collections](#collections)
- [Explanation](#explanation)
- [Exercises](#exercises)
- [Articles](#articles)
- [Books](#books)
- [Benchmarks](#benchmarks)
- [Cheat Sheets](#cheat-sheets)
## Documentation
- [Regular Expression Language - Quick Reference](https://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx) - MSDN documentation about Regex.
- [Regular Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) - MDN chapter about JavaScript regular expressions.
- [Perl Regular Expression Syntax](http://www.boost.org/doc/libs/1_43_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html) - Boost documentation.
- [Perl 6](https://docs.perl6.org/language/regexes) - Regexes in Perl 6.
- [PCRE](http://pcre.org/pcre.txt) - Concatenated PCRE man pages.
- [ECMAScript 6](http://2ality.com/2015/07/regexp-es6.html) - New Regexes in ECMAScript 6.
- [regex header in C++](http://www.cplusplus.com/reference/regex/) - `<regex>` in C++
- [class Pattern in Java](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html) - Java 7 docs.
- [class Regex in Scala](http://www.scala-lang.org/api/2.12.1/scala/util/matching/Regex.html) - Scala Regex.
- [Python re module](https://pymotw.com/3/re/) - Regular Expressions Python module tutorial.
- [Regular Expressions in Perl](http://perl-begin.org/topics/regular-expressions/) - Introduction and Reference Links.
## Prototyping and Testing
- [Debuggex](https://www.debuggex.com/) - Online visual Regex tester.
- [ExtendsClass](https://extendsclass.com/regex-tester.html) - Online visual Regex tester.
- [Nodexr](https://www.nodexr.net) - Online node-based Regex editor.
- [Regexr](http://regexr.com/) - Website for interactive Regex prototyping with syntax highlighting (by @gskinner).
- [Regex101](https://regex101.com/) - Online Regex tester, debugger with highlighting.
- [Rubular](http://rubular.com/) - Ruby-based regular expression editor and tester.
- [Rex V](http://www.rexv.org/) - AJAX Regular EXpression eValuator.
- [RegViz](http://regviz.org/) - Tool for debugging JavaScript regular expressions in a visual way.
- [Regulex](https://jex.im/regulex) - JavaScript Regular Expression Visualizer.
- [PyRegex](http://www.pyregex.com/) - Online Regex tester to check validity of Regex in the Python language Regex subset.
- [pythex](http://pythex.org/) - Quick way to test your Python regular expressions.
- [Regexper](http://regexper.com/) - Regex visualizer for JavaScript using railroad diagrams.
- [HiFi Regex Tester](http://www.gethifi.com/tools/regex) - Live JavaScript Regular Expression Tester.
- [Regex Hero](http://regexhero.net/tester/) - .NET online Regex tester.
- [Regex Storm](http://regexstorm.net/tester) - .NET Regex tester with highlighting and detailed results output.
- [RegEx to Strings](https://www.wimpyprogrammer.com/regex-to-strings/) - JavaScript library and online tool to generate strings that a regular expression would match.
- [RegexPal](http://www.regexpal.com) - JavaScript + PCRE online tester.
- [RegexTester](http://www.regextester.com) - Regular Expression Tester with highlighting for Javascript and PCRE.
- [Free Formatter](http://www.freeformatter.com/regex-tester.html) - Free online Regex tester.
- [Regex Tester - Golang](https://regex-golang.appspot.com/assets/html/index.html) - A secure regular expression tester. built using Go
- [PHP Live Regex](https://www.phpliveregex.com) - PHP specific regular expression tester with live evaluation and code generation for all PHP's regex functions.
## Generators
- [Txt2Re](https://www.txt2re.com/index_php3.html) - Generate Regular expressions based on a string
- [Regex Generator++](http://regex.inginf.units.it) - Automatic Generation of Text Extraction Patterns from Examples
- [regexgen](https://github.com/devongovett/regexgen) - Generates regular expressions that match a set of strings.
- [RegexGenerator](https://github.com/MaLeLabTs/RegexGenerator) - A tool for generating regular expressions for text extraction (by @MaLeLabTs)
- [Gamon's numberic range generator](http://gamon.webfactional.com/regexnumericrangegenerator/) - Regex Numeric Range Generator, when you need to match an integer range.
- [rgxg](https://rgxg.github.io) - Command line tool to generate Regex
- [Strings to RegEx](https://www.wimpyprogrammer.com/strings-to-regex/) - JavaScript library and online tool to generate a regular expression that matches strings.
- [Regex Guide](https://regex.guide/playground) - Plain Text to Regex Generator.
- [grex](https://github.com/pemistahl/grex) - A command-line tool and library for generating regular expressions from user-provided test cases.
- [AutoRegex](https://www.autoregex.xyz/home) - English <-> Regex from an AI.
## Security
- [SafeRegex](https://github.com/jkutner/saferegex) - A command-line tool for testing regular expressions for [ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) vulnerabilities.
## Learning
- [Wikipedia][d1] - Entry on regular expressions.
- [Learn Regex The Hard Way][d2] - In-progress book that quickly teaches you regular expressions.
- [Regular Expression Matching Can Be Simple And Fast][d3] - Basic concept of how Regex parsing works.
- [PDF] [A Tao Of Regular Expressions][d4] - What are Regular Expressions.
- [Regular-Expressions.info][d5] - Informative website for learning regular expressions.
- [RexEgg][d6] - A regular expressions tutorial that goes deep into advanced features.
- [Try Regex][d7] - Try Regex is an interactive regular expressions tutorial.
- [Udemy][d8] - A Basic Introduction To Using Regular Expressions In Programming.
- [Codecademy][d9] - How to use of regular expression.
- [Regex golf][d10] - Regex golf with Peter Norvig.
- [Python Regular Expressions][d11] - A good introduction to Python Regular Expressions from Google.
- [/Reg(exp){2}lained/: Demystifying Regular Expressions][d12] - Fluent 2012 talk reviewing and visualizing basic and intermediate Regular Expressions.
- [Regular Expressions - Everything you should know][d13] - PDF Series.
- [The Java Tutorials][d14]
- [Regex Syntax Summary][d15]
- [How Regexes work][d16]
- [Learn Regular Expressions for Beginners][d17]
- [Java Regex Tutorial][d18]
- [Javascript.info - Regular expressions][d19] - Regular expressions section in The Modern JavaScript Tutorial
- [Useful Regexes][d20]
- [Teach Yourself Regular Expressions][d21]
- [Interactive Regex Tutorial][d22] - Learn Regex step by step, from zero to advanced.
[d1]: http://en.wikipedia.org/wiki/Regular_expression
[d2]: http://regex.learncodethehardway.org/book/
[d3]: http://swtch.com/~rsc/regexp/regexp1.html
[d4]: http://linuxreviews.org/beginner/tao_of_regular_expressions/tao_of_regular_expressions.en.print.pdf
[d5]: http://www.regular-expressions.info/
[d6]: http://www.rexegg.com/
[d7]: http://tryregex.com/
[d8]: https://www.udemy.com/learning-regular-expressions/
[d9]: http://www.codecademy.com/courses/javascript-intermediate-en-NJ7Lr/0/1
[d10]: https://www.oreilly.com/learning/regex-golf-with-peter-norvig
[d11]: https://developers.google.com/edu/python/regular-expressions
[d12]: https://www.youtube.com/watch?v=EkluES9Rvak
[d13]: http://neverfear.org/blog/view/Regex_tutorial_for_people_who_should_know_Regex__but_do_not___Part_1
[d14]: https://docs.oracle.com/javase/tutorial/essential/regex/resources.html
[d15]: http://www.greenend.org.uk/rjk/2002/06/regexp.html
[d16]: http://perl.plover.com/Regex/
[d17]: https://hackernoon.com/javascript-learn-regular-expressions-for-beginners-bb6107015d91
[d18]: http://www.vogella.com/tutorials/JavaRegularExpressions/article.html
[d19]: https://javascript.info/regular-expressions
[d20]: https://atrilsolutions.zendesk.com/hc/en-us/articles/205539861-Useful-regular-expressions
[d21]: http://rads.stackoverflow.com/amzn/click/0672325667
[d22]: https://regexlearn.com/
## Libraries
- [Tre](https://laurikari.net/tre/) - Free and portable approximate Regex matching library.
- [Go-Restructure](https://github.com/alexflint/go-restructure) - Match regular expressions into struct fields in Go (by @alexflint). [js](https://github.com/benjamingr/js-restructure) [C#](https://gist.github.com/benjamingr/4de21494b3e76088e5f7)
- [js-regex](https://github.com/wyantb/js-regex) - Chainable API for constructing Regexes.
- [VerbalExpressions](https://github.com/VerbalExpressions) - VerbalExpressions is a cross-language library that helps to construct difficult regular expressions.
- [Super Expressive](https://github.com/francisrstokes/super-expressive) - Super Expressive is a JavaScript library that allows you to build regular expressions in natural language.
- [XRegExp](http://xregexp.com) - JavaScript Regex library.
- [RE2](https://github.com/google/re2) - RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python. It is a C++ library.
- [Hyperscan](https://github.com/01org/hyperscan) - High-performance multiple Regex matching library.
## Collections
- [RegexLib](http://regexlib.com/) - Regular Expression Library (5000+ indexed expressions).
- [Regexhub](https://projects.lukehaas.me/regexhub/) - Useful Regex Patterns.
- [RGXP.RU](https://rgxp.ru/) - Regular Expression Patterns (+testing)
## Explanation
- [RegexTranslator](https://www.regextranslator.com/) - A web app to decode Regex into plain English. You can edit it and translate back.
- [Explain.pl](http://rick.measham.id.au/paste/explain.pl) - Explain Regular Expressions.
## Exercises
- [HackerRank Regex Challenges](https://www.hackerrank.com/domains/regex/re-introduction) - Regex challenges with varying levels of difficulty.
- [Redoku](http://padolsey.github.io/redoku/) - Little Regex Sudoku/Crossword thing (by @padolsey).
- [Regex Tuesday - Challenges](https://github.com/callumacrae/regex-tuesday) - Challenge list about Regex.
- [Regex Crossword](http://regexcrossword.com) - A crossword puzzle game using regular expressions.
- [RegexOne](http://regexone.com) - Learn regular expressions with simple, interactive examples.
- [Regex Exercises](https://regex.sketchengine.co.uk/) - Regexp exercises.
- [Regular Expression Crossword Puzzle](http://gregable.com/2015/12/regular-expression-crossword-puzzle.html) - A crossword puzzle with a neat web interface.
## Articles
- [5 Techniques to Improve Regex Performance](https://www.loggly.com/blog/five-invaluable-techniques-to-improve-regex-performance/) - Craft your own powerful, yet efficient regex.
- [The Bad, the Better, and the Best](https://www.loggly.com/blog/regexes-the-bad-better-best/) - How a few characters can make a difference in performance.
- [The Greatest Regex Trick Ever](http://www.rexegg.com/regex-best-trick.html) - So you're doubtful at the mention of a "best Regex trick"?
- [Treat regular expressions as code, not magic](http://alexwlchan.net/2016/04/regexes-are-code/) - If you dont write them carefully, you can end up with an unmaintainable monstrosity.
- [Demystifying The Regular Expression That Checks If A Number Is Prime](https://iluxonchik.github.io/regular-expression-check-if-number-is-prime/) - How a regular expression can check if a number is prime.
- [Regex Tree: a regular expressions processor](https://medium.com/@DmitrySoshnikov/regexp-tree-a-regular-expressions-parser-with-a-simple-ast-format-bcd4d5580df6)
- [The thirty minute regex tutorial](https://www.codeproject.com/Articles/9099/The-Minute-Regex-Tutorial) - Regular Expressions in 30 Minutes.
- [Regular Expression Matching Can Be Simple And Fast](https://swtch.com/~rsc/regexp/regexp1.html)
- [Regular Expressions in a post ES6 World](https://ponyfoo.com/articles/regular-expressions-post-es6)
- [Regular expression (regex) performance: The fundamental guide](https://medium.com/@lennartkoopmann/regular-expression-regex-performance-the-fundamental-guide-3d39e6af33af)
- [The New Absent Operator in Rubys Regular Expressions](https://medium.com/rubyinside/the-new-absent-operator-in-ruby-s-regular-expressions-7c3ef6cd0b99)
- [Optimizing regexes in Java](http://www.javaworld.com/article/2077757/core-java/optimizing-regular-expressions-in-java.html)
- [Use Regex to Test Password Strength in JavaScript](https://dzone.com/articles/use-regex-test-password)
- [Java 101](http://www.javaworld.com/article/3188545/learn-java/java-101-regular-expressions-in-java-part-1.html) - Regular Expressions in Java.
- [Most Crazy Regexes](https://stackoverflow.com/questions/800813/what-is-the-most-difficult-challenging-regular-expression-you-have-ever-written) - Stack Overflow
- [Regex Humor](http://www.rexegg.com/regex-humor.html) - Regex jokes and cartoons.
- [The true power of regular expressions](https://nikic.github.io/2012/06/15/The-true-power-of-regular-expressions.html)
- [On code, early neural networks, and once discredited AI pioneers](https://whyisthisinteresting.substack.com/p/the-regular-expression-edition) - A short history of regexes
## Books
- [Patterns, Automata, and Regular Expressions](http://infolab.stanford.edu/~ullman/focs/ch10.pdf) - Al Aho and Jeff Ullman (1992) (*chapter 10 of [Foundations of Computer Science](http://infolab.stanford.edu/~ullman/focs.html)*)
- [Beginning Regular Expressions](http://shop.oreilly.com/product/9780764574894.do) - Andrew Watt (2005)
- [Mastering Regular Expressions](http://shop.oreilly.com/product/9780596528126.do) - Jeffrey E.F. Friedl (2006)
- [Regular Expression Pocket Reference](http://shop.oreilly.com/product/9780596514273.do) - Tony Stubblebine (2007)
- [Introducing Regular Expressions](http://shop.oreilly.com/product/0636920012337.do) - Michael Fitzgerald (2012)
- [Regular Expressions Cookbook](http://shop.oreilly.com/product/0636920023630.do) - Jan Goyvaerts & Steven Levithan (2012)
- [Mastering Python Regular Expressions](http://shop.oreilly.com/product/9781783283156.do) - Felix Lopez & Victor Romero (2014)
- [JavaScript Regular Expressions](http://shop.oreilly.com/product/9781783282258.do) - Loiane Groner & Gabriel Manricks (2015)
- [Regex - the complete tutorial](https://www.princeton.edu/~mlovett/reference/Regular-Expressions.pdf)
- [Python re(gex)?](https://github.com/learnbyexample/py_regular_expressions) - Sundeep Agarwal (2020)
## Benchmarks
- [Benchmark of Regex Libraries](http://lh3lh3.users.sourceforge.net/reb.shtml)
- [Java regular expression library benchmarks 2015](https://www.javaadvent.com/2015/12/java-regular-expression-library-benchmarks-2015.html)
- [Languages Regex Benchmark](https://github.com/mariomka/regex-benchmark) - It's just a simple Regex benchmark of different programming languages.
- [Performance comparison of regular expression engines](http://sljit.sourceforge.net/regex_perf.html)
- [Regex Performance](https://github.com/rust-leipzig/regex-performance) - Performance comparison of regular expression engines.
## Cheat Sheets
- [Regular Expressions Cheat Sheet](https://www.cheatography.com/davechild/cheat-sheets/regular-expressions/)
- [Regex Cheat Sheet](http://www.rexegg.com/regex-quickstart.html)
- [MIT Cheat Sheet](http://web.mit.edu/hackl/www/lab/turkshop/slides/regex-cheatsheet.pdf)
- [Java Cheat Sheet](https://zeroturnaround.com/rebellabs/java-regular-expressions-cheat-sheet/)
- [JavaScript Cheat Sheet](https://www.debuggex.com/cheatsheet/regex/javascript)
- [RegexLearn Cheat Sheet](https://regexlearn.com/cheatsheet)
# Other awesome lists
Other amazingly awesome lists can be found at the [official awesome list](https://github.com/sindresorhus/awesome) and [here](https://github.com/jnv/lists).
[regex.md Github](https://github.com/slevithan/awesome-regex
)