Skip to content

Latest commit

 

History

History
46 lines (40 loc) · 2.29 KB

regex.org

File metadata and controls

46 lines (40 loc) · 2.29 KB

Regex

Identifiers

IdentifierDescription
\dany number
\Danything but a number
\sspace
\Sanything but a space
\wany character
\Wanything but a character
\bthe whitespace around words
.any character expect for a new line
\.a period

Modifiers

ModifierDescription
{1, 3}we’re expecting 1-3 ex: \d{1, 3}
{x}expecting “x” ammount
+Match 1 or more
?Match 0 or 1
*Match 0 or more
$Match the end of a string
^Matching the beginning of a string
[]range or “variance” [A-Z]

Misc

ExpressionDescription
^negates a character class (eg: /[^g-f]/ – NOT between g and f)
\W[^\w]
\D[^\d]
\S[^\s]
(?:ABC)won’t capture the group
AB(?=C)lookahead, will match when AB is followed by C, but C won’t be matched
(?<name>.*)gives a group a name