Regex
Regular expressions
MetaCharacters (Need to be escaped)
. ^ $ * + ? { } [ ] \ | ( )
Characters
.
- Any Character Except New Line
\d
- Digit (0-9)
\D
- Not a Digit (0-9)
\w
- Word Character (a-z, A-Z, 0-9, _)
\W
- Not a Word Character
\s
- Whitespace (space, tab, newline)
\S
- Not Whitespace (space, tab, newline)
Character Classes
[]
- Matches Characters in brackets
[^ ]
- Matches Characters NOT in brackets
[a-z]
- Any lowercase character between a and z
[A-Z]
- Any UPPERCASE character between A and Z
Quantifiers
*
- 0 or More
+
- 1 or More
?
- 0 or One
{3}
- Exact Number
{3,4}
- Range of Numbers (Minimum, Maximum)
{3,}
- At least 3
Anchors & Boundaries
\b
- Word Boundary
\B
- Not a Word Boundary
^
- Beginning of a String
$
- End of a String
Logic
|
- Either Or
( )
- Group
\1
- Contents of group 1
White-space
\t
- Tab
\r
- Carriage return
\n
- New line
Snippets
Markdown link pattern
\[([^\]]+)\]\(([^\)]+)\)