Regular Expression Flags; i: Ignore case: m ^ and $ match start and end of line: s. Matches newline as well: x: Allow spaces and comments: L: Locale character classes: u: Unicode character classes (?iLmsux) Set flags within regex. Regular Expression Options. You can specify options that control how the regular expression engine interprets a regular expression pattern. Many of these options can be specified either inline (in the regular expression pattern) or as one or more RegexOptions constants. This quick reference lists only inline options.
Need a little extra help with those Regular Expression(regex) functions? Then look no further! Here, I have put together the best top 10 regex cheat sheets for you to download, print and pin to the bathroom wall!!
This cheat sheets will be a great reference when you need to put them in your scripts when you are web scraping and trying to find information or when you need help to authenticate users and passwords!
All the regex cheat sheets in this article are 100% free. All links open a new tab (feel free to open all the links without losing this page!)
Cheat Sheet 1: Rexegg.com
This first sheet is from Rexegg.com. The entire list is one that is commonly used Regex expressions in Python and other languages. This list includes Characters, Quantifiers and more. It will even tell you what language this expression can be used in! This makes it a lot easier when you go to write a regex in your language preference. This website really does emphasize looking at the tables for the expressions by keeping the tables bright on a black background. Making it easy to read the table but very difficult to read the information on regex itself.
Pros: Tables are bright and easy to read. Contains a lot of information shorthand to write regex
Cons: Information on the page is very dark and difficult to read.
Cheat Sheet 2: Regular Expressions cheat sheet – MIT
This second sheet was written by MIT. It is very spartan with no color and straight to the point on what the expressions are and what they do. This is the perfect cheat sheet if you do not want to be distracted by color or graphics. However, since it is very dry in the manner of text, I would not suggest this particular cheat sheet to someone who is just learning regular expressions since the explanations and examples are minimal.
Pros: Clean text, no colors for distraction, contains a lot of information shorthand to write regex
Cons: Too spartan for a total beginner in Regex
Cheat Sheet 3: Cheatography.com
I really love this website! This sheet was put together by Dave Child for regular expressions. It’s a nice quick reference guide pdf you can print in bright pink. It is easy to read and rated ‘E’ for everyone! It includes symbols, ranges, grouping, assertions and more with sample patterns to help get you on your way! Cheatography is one of my favorite websites for cheat sheet because they have so many on so many different topics and in many styles. It’s nice to find a one stop shop for cheat sheets.
Pros: Explains regex easily, uses soft colors, contains a lot of information.
Cons: Color may be distracting to some.
Cheat Sheet 4: Dev.to
Regex Cheat Sheet C#
Dev.to is a great place for new and experienced developers! This regex list was written by Catherine on her dev.to profile where she explains regex expressions in Java-script she has compiled with her resources at the bottom of here article.
Pros: Great spot to read someone else’s experience in regex and to gather new resources
Cons: More of an article than an actual pdf to print.
Cheat Sheet 5: Last Call – The Rapid API Blog
This is another great website for developers! This cheat sheet is also very easy to read and understand. It has additional resources beneath the code written. There are no examples in the post but there is shorthand explanations for each expression, characters and quantifiers. I would not suggest this particular cheat sheet for a beginner.
Pros: Great for those who understand regex and don’t have a need for examples
Cons: Not for Beginners since it has minimal explanation
Cheat Sheet 6: GREP
Here is another one! This one is minimal in color to keep distractions down. Key words are in red and examples are done in yellow. There are minimal explanations in the color keys. This sheet is for the advanced regex user who only needs a quick reference. It is clean and easy to read. It covers all of the information needed to write your own regex!
Pros: Written cleanly, additional resources at the bottom, to the point.
Cons: Not for the regex beginner.
Cheat Sheet 7: Regex chart
This Regex sheet is a very quick one with only the characters, the meaning and an example. This one is also for the advanced regex user. There is only the bare minimum here and this particular sheet does not contain quantifiers or expressions. There is a link however to a regex character classes cheat sheet.
Pros: Very quick reference of only character in regex
Cons: Not for a beginner regex user.
Cheat Sheet 8: Keycdn
Here is another awesome website to learn Regular expressions from! It goes over what regex is, gives you the list of expressions and gives you 2 separate examples on how regex is used in find numbers and emails. Near the bottom it even give you 3 tools to help you learn how to build a proper regex formula! These test sites will help you not only to build regex but compile it and make sure it running correctly before implementing it into your code.
Regular Expression Tester
Pros: Not only information but tools as well!
Cons: none as far I can see.
Cheat Sheet 9: MDN Web Docs
This regex syntax cheat sheet is on one of my absolute favorite places to learn about web development!! Named Moz:a (pronounced Mozilla) this particular guide will walk through not only the syntax but take you to the complete guide on regex! This cheat sheet is rated ‘E’ for everyone! It has clear examples and explanations on beginner and advanced regex characters and expressions.
Pros: Great for Everyone!!
Cons: N/A
Cheat Sheet 10: Dataquest
The final cheat sheet!! This final cheat sheet is from Dataquest. This particular cheat sheet was written specifically for Python!! This pdf is downloadable for free and explains each character and expression in detail. There is a lot of information packed in this pdf each under the proper heading and minimal color for the least number of distractions.
Pros: A lot of information pack in with minimal color.
Cons: Can appear to be overwhelming at first glance to a beginner.
I would like to thank you for taking the time to read this article. I hope that you are able to use at least one of these cheat sheets the next time you need to put a regular expression in your coding! The best way to learn though is to practice!! Good luck with writing your regex!!
Related Articles: