nav_title |
permalink |
hidden |
Regex reference sheet |
/regex_cheat_sheet/ |
true |
This page serves as a quick reference guide for regular expression, including common tokens, meta sequences, general tokens, group constants, and more.
{% tabs %}
{% tab Common tokens %}
Common tokens |
A single character of: a, b, or c |
A character except: a, b, or c |
A character in the range: a-z |
A character not in range: a-z |
A character in the range: a-z or A-Z |
Any single character |
Any whitespace character |
Any non-whitespace character |
Any digit |
Any non-digit |
Any word character |
Any non-word character |
Capture enclosed |
Match either a or b |
Zero or one of a |
Zero or more of a |
One or more of a |
Exactly 3 of a |
Between 3 and 6 of a |
Start of string |
End of string |
A word boundary |
None-word boundary |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %} |
{% tab Meta sequence %} |
Meta sequence |
Any Unicode sequences, line breaks included |
Match one data unit |
Unicode newlines |
Vertical whitespace character |
Negation of \v |
Horizontal whitespace character |
Negation of \h |
Reset match |
Match nth sub-pattern |
Unicode property X |
Negation of \pX |
Unicode property or script category |
Negation of \p |
Quote; treat as liberals |
Match sub-pattern 'name' |
Match sub-pattern 'name' |
Match sub-pattern 'name' |
Match nth sub-pattern |
Match nth sub-pattern |
Recurse nth capture group |
Recurse nth capture group |
Match nth relative previous sub-pattern |
Recurse nth relative upcoming sub-pattern |
Match nth relative upcoming submitter |
Recursive names capture group |
Match previously-named capture group 'letter' |
Recurses names capture group 'letter' |
Hex character YY |
Hex character YYYY |
Octal character ddd |
Control character Y |
Backspace character |
Makes any character literal |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %} |
{% tab General tokens %} |
General tokens |
Newline |
Carriage return |
Tab |
Null character |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %}
{% tab Character class modifiers %}
Character class modifiers |
A single character of: a, b, or c |
A character except: a, b, or c |
A character in the range: a-z |
A character not in range: a-z |
A character in the range: a-z or A-Z |
Letters and digits |
Letters |
ASCII codes 0-127 |
Space or tab only |
Control characters |
Digits |
Visible characters (not space) |
Lowercase letters |
Uppercase letters |
Word characters |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %} |
{% tab Group constants %} |
Group constants |
Capture everything enclosed |
Match either a or b |
Match everything enclosed |
Atomic grouping (non-capturing) |
Duplicate sub-pattern group number |
Comment |
For case insensitivity |
Named capturing group |
Named capturing group |
Named capturing group |
Inline modifiers |
Conditional statements |
Recursive conditional statements |
Conditional statement |
Lookahead conditional |
Lookbehind conditional |
Recurse entire pattern |
Recurse first sub-pattern |
Recurse first relative subpattern |
Recurse subpattern 'name' |
Match subpattern 'name' |
Recurse subpattern 'name' |
Pre-define patterns before use |
Positive lookahead |
Negative lookahead |
Positive lookbehind |
Negative lookbehind |
Control verb |
Control verb |
Control verb |
Control verb |
Control verb |
Control verb |
Control verb |
Pattern modifier |
Pattern modifier |
Pattern modifier |
Pattern modifier |
Pattern modifier |
Line break modifier |
Line break modifier |
Line break modifier |
Line break modifier |
Line break modifier |
Line break modifier |
Line break modifier |
Line break modifier |
Regex engine modifier |
Regex engine modifier |
Regex engine modifier |
Regex engine modifier |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %} |
{% tab Quantifiers %} |
Quantifiers |
Zero or one of a |
Zero or more of a |
One or more of a |
Exactly 3 of a |
3 or more of a |
Between 3 and 6 of a |
Greedy quantifier |
Lazy quantifier |
Possessive quanitifer |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %} |
{% tab Anchors %} |
Anchors |
Start of match |
Start of string |
End of string |
Start of string |
End of string |
Absolute end of string |
A word boundary |
A non-word boundary |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %} |
{% tab Flags and modifiers %}
Flags and modifiers |
Global |
Multiline |
Case-sensitive |
Ignore whitespace |
Single line |
Unicode |
Extended |
Ungreedy |
Anchor |
Duplicate group names |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %}
{% tab Substitution %}
Substitution |
Complete match contents |
Contents in capture group 1 |
Contents in capture group foo |
Hexidecimal replacement values |
Tab |
Carriage return |
Newline |
Form-feed |
Uppercase transformation |
Lowercase transformation |
Terminate any transformation |
{: .reset-td-br-1 .reset-td-br-2} |
{% endtab %} |
{% endtabs %} |