0% found this document useful (0 votes)
9 views1 page

Regex Cheatsheet

regex cheatsheet

Uploaded by

eucon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Regex Cheatsheet

regex cheatsheet

Uploaded by

eucon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

REGEX CHEAT SHEET

The most commonly used metacharacters in Python, PHP, Perl, JavaScript, and Ruby regular expressions

Metacharacters Meaning
\n Newline
[…] Range or character class
[^…] Not in range or negated character class
. (dot or point) Any character except newline
\w Word character [a-zA-Z0-9_]
\W Nonword character [^a-zA-Z0-9_]
\d Digit character [0-9]
\D Nondigit character [^0-9]
\s Whitespace character [\n\r\f\t]
\S Nonwhitespace character [^\n\r\f\t]
^ (caret) The start of the line of text
$ (dollar) The end of the line of text
\b Word boundary
\B Not-word-boundary
i Case-insensitive matching
m ^ and $ match next to embedded \n
(…) Group subpattern and capture submatch into \1, \2, ..
Contains the result of nth earlier submatch from a parentheses capture group, or a named capture
\n
group
* (asterisk or star) Match 0 or more times
+ (plus) Match 1 or more times
? (question mark) Match 1 or 0 times
{n} Match exactly n times

Don’t forget to visit http://regexcheatsheet.com

You might also like