Quick Start
Tutorial
Tools & Languages
Examples
Reference
Book Reviews
RegexBuddy—Better than a regular expression reference!

Regular Expression Reference: Special and Non-Printable Characters

FeatureSyntaxDescriptionExample JGsoft .NET Java Perl PCRE PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE POSIX BRE POSIX ERE GNU BRE GNU ERE Oracle XML XPath
Literal character Any character except [\^$.|?*+() All characters except the listed special characters match a single instance of themselves a matches a YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYES
Literal curly braces { and } { and } are literal characters, unless they're part of a valid regular expression token such as a quantifier {3} { matches { YESYESno5.8–5.20YESYESYESYESYESYESYESYESYES1.9basic
grep
ECMA 1.54–1.65
basic 1.38–1.63
grep 1.38–1.65
YESYESYESYESnoYESYESno
Backslash escapes a metacharacter \ followed by any of [\^$.|?*+(){} A backslash escapes special characters to suppress their special meaning \* matches * YESYESno5.8–5.20YESYESYESYESYESYESYESYESYES1.9basic
grep
ECMA 1.54–1.65
basic 1.38–1.63
grep 1.38–1.65
YESYESYESYESnoYESYESno
Escape sequence \Q...\E Matches the characters between \Q and \E literally, suppressing the meaning of special characters \Q+-*/\E matches +-*/ YESnoYESYESYESYESYESYESYESnonononononoECMA
extended
egrep
awk
nononononononono
Hexadecimal escape \xFF where FF are 2 hexadecimal digits Matches the character at the specified position in the code page \xA9 matches © when using the Latin-1 code page YESYESYESYESYESYESYESYESYESYESYESYESYESYESECMAECMA
extended
egrep
awk
YESstringstringstringstringnonono
Character escape \n, \r and \t Match an LF character, CR character and a tab character respectively \r\n matches a Windows CRLF line break YESYESYESYESYESYESYESYESYESYESYESYESYESYESECMA
awk
ECMA
extended
egrep
awk
YESstringstringstringstringnoYESYES
Line break \R Matches any line break, including CRLF as a pair, CR only, LF only, form feed, vertical tab, and any Unicode line break V2no85.107.0YES5.2.2YESYESnononono2.0noECMA
1.42–1.65
nononononononono
Line break \R Matches the next line control character U+0085 V2n/a85.107.0YES5.2.2YESYESn/an/an/an/a2.0n/aECMA
1.54–1.65
n/an/an/an/an/an/an/an/a
Line break Literal CRLF, LF, or CR line break Matches CRLF as a pair, CR only, and LF only regardless of the line break style used in the regex YESnononononononononononononononononononononoYESYES
Character escape \a Match the "alert" or "bell" control character (ASCII 0x07) YESYESYESYESYESYESYESYESYESnononoYESYESawkECMA
extended
egrep
awk
YESnonononononono
Character escape \b Match the "backspace" control character (ASCII 0x08) nonononononononononononononoawknoYESnonononononono
Character escape \B Match a backslash \B matches \ nonononononononononononononononoYESnonononononono
Character escape \e Match the "escape" control character (ASCII 0x1A) YESYESYESYESYESYESYESYESYESnonononoYESnoECMA
extended
egrep
awk
YESnonononononono
Character escape \f Match the "form feed" control character (ASCII 0x0C) YESYESYESYESYESYESYESYESYESYESYESYESYESYESECMA
awk
ECMA
extended
egrep
awk
YESnonononononono
Character escape \v Match the "vertical tab" control character (ASCII 0x0B), but not any other vertical whitespace. V1 onlyYES4–7nonononononoYESYESYESYESYESECMA
awk
ECMA 1.38–1.39
extended 1.38–1.65
egrep 1.38–1.65
awk 1.38–1.65
YESnonononononono
Control character escape \cA through \cZ Match an ASCII character Control+A through Control+Z, equivalent to \x01 through \x1A \cM\cJ matches a Windows CRLF line break V1 onlyYESYESYESYESYESYESYESYESYESYESYESnoYESECMAECMA
extended
egrep
awk
YESnonononononono
Control character escape \ca through \cz Match an ASCII character Control+A through Control+Z, equivalent to \x01 through \x1A \cm\cj matches a Windows CRLF line break V1 onlyYESnoYESYESYESYESYESYESYESYESYESnoYESECMAECMA
extended
egrep
awk
YESnonononononono
NULL escape \0 Match the NULL character noYESnoYESYESYESYESYESYESYESYESYESYESYESECMAYESYESnonononononono
Octal escape \o{7777} where 7777 is any octal number Matches the character at the specified position in the active code page \o{20254} matches when using Unicode V2nono5.148.34YES5.5.10XE73.0.3nonononononononononononononono
Octal escape \1 through \7 Matches the character at the specified position in the ASCII table \7 matches the "bell" character noECMAnononononononoYESYESnononoawknonononononononono
Octal escape \10 through \77 Matches the character at the specified position in the ASCII table \77 matches ? noYESnoYESYESYESYESYESYESYESYESnonoYESawknoYESnonononononono
Octal escape \100 through \177 Matches the character at the specified position in the ASCII table \100 matches @ noYESnoYESYESYESYESYESYESYESYESnoYESYESawknoYESnonononononono
Octal escape \200 through \377 Matches the character at the specified position in the active code page \377 matches ÿ when using the Latin-1 code page nonon‑ECMA 2.0–4.6
ECMA 2.0–4.7
noYESYESYESYESYESYESYESYESnoYES1.8 only failawknoYESnonononononono
Octal escape \400 through \777 Matches the character at the specified position in the active code page \777 matches ǿ when using Unicode nonon‑ECMA
1.0–1.1 fail
no5.146.7YES5.2.0YESYESnonono3.5 error1.8 only failawkno8.4–8.5nonononononono
Octal escape \01 through \07 Matches the character at the specified position in the ASCII table \07 matches the "bell" character V1 onlyYESYESYESYESYESYESYESYESYESYESnoYESYESawkYESYESnonononononono
Octal escape \010 through \077 Matches the character at the specified position in the ASCII table \077 matches ? V1 onlyYESYESYESYESYESYESYESYESYESYESnoYESYESawkYESYESnonononononono
Octal escape \0100 through \0177 Matches the character at the specified position in the ASCII table \0100 matches @ V1 onlynoYESnonononononononononononoYESnononononononono
Octal escape \0200 through \0377 Matches the character at the specified position in the active code page \0377 matches ÿ when using the Latin-1 code page V1 onlynoYESnonononononononononononoYESnononononononono
FeatureSyntaxDescriptionExample JGsoft .NET Java Perl PCRE PCRE2 PHP Delphi R JavaScript VBScript XRegExp Python Ruby std::regex Boost Tcl ARE POSIX BRE POSIX ERE GNU BRE GNU ERE Oracle XML XPath

Make a Donation

Did this website just save you a trip to the bookstore? Please make a donation to support this site, and you'll get a lifetime of advertisement-free access to this site! Credit cards, PayPal, and Bitcoin gladly accepted.

Regex Reference
Introduction
Table of Contents
Quick Reference
Characters
Basic Features
Character Classes
Shorthands
Anchors
Word Boundaries
Quantifiers
Unicode
Capturing Groups & Backreferences
Named Groups & Backreferences
Special Groups
Mode Modifiers
Recursion & Balancing Groups
Replacement Reference
Characters
Matched Text & Backreferences
Context & Case Conversion
Conditionals
More on This Site
Introduction
Regular Expressions Quick Start
Regular Expressions Tutorial
Replacement Strings Tutorial
Applications and Languages
Regular Expressions Examples
Regular Expressions Reference
Replacement Strings Reference
Book Reviews
Printable PDF
About This Site
RSS Feed & Blog