Quick Start
Tutorial
Search & Replace
Tools & Languages
Examples
Reference
Regex Reference
Introduction
Table of Contents
Quick Reference
Characters
Basic Features
Character Classes
Shorthands
Anchors
Word Boundaries
Quantifiers
Capturing Groups & Backreferences
Named Groups & Backreferences
Special Groups
Unicode Characters and Properties
Unicode Versions
Unicode Categories
Unicode Scripts
Unicode Blocks
Unicode Binary Properties
Unicode Property Sets
Unicode Boundaries
Mode Modifiers
Recursion & Balancing Groups
Backtracking Control Verbs
Replacement Reference
Characters
Matched Text & Backreferences
Case Conversion
Context
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
RegexBuddy—Better than a regular expression reference!

Regular Expression Reference: Special and Non-Printable Characters

FeatureSyntaxDescriptionExampleJGsoft Python JavaScript VBScript XRegExp .NET Java ICU RE2 Perl PCRE PCRE2 PHP Delphi R Ruby std::regex Boost Tcl POSIX GNU 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 character ] ] is a literal character outside of character classes } matches } YESYESwithout /uYESYESYESYESYESYESYESYESYESYESYESYESnoextended
egrep
awk
YESYESYESYESYESnono
Literal character ) ) is a literal character without a preceding ( to match it ) matches ) nonononononononononononononononobasic
extended
grep
egrep
awk
basic
grep
noYESYESnonono
Literal character { { is a literal character, unless it is part of a valid regular expression token such as a quantifier {3} { matches { YESYESwithout /uYESYESYESnonoYESYESYESYESYESYESYES1.9basic
grep
ECMA 1.54
basic 1.38
grep 1.38
YESYESbasicYESnono
Literal character } } is a literal character, unless it is part of a valid regular expression token such as a quantifier {3} } matches } YESYESwithout /uYESYESYESYESnoYESYESYESYESYESYESYES1.9basic
extended
grep
egrep
awk
ECMA 1.58
basic 1.38
grep 1.38
YESYESYESYESnono
Backslash escapes a metacharacter \ followed by any of [\^$.|?*+(){} A backslash escapes special characters to suppress their special meaning \* matches * YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYES
Escape sequence \Q...\E Matches the characters between \Q and \E literally, suppressing the meaning of special characters \Q+-*/\E matches +-*/ YESnononononoYESYESdefaultYESYESYESYESYESYESnonoECMA
extended
egrep
awk
nononononono
Hexadecimal escape \xF where F is a single hexadecimal digit Matches the character at the specified position in the ASCII table \xA matches a line feed control character nononononononoYESnoYESYESYESYESYESYESYESstringECMA
extended
egrep
awk
YESnonononono
Hexadecimal escape \x7F where 7F are 2 hexadecimal digits between 00 and 7F Matches the character at the specified position in the ASCII table \x40 matches @ YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESECMAECMA
extended
egrep
awk
YESstringstringnonono
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 YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESnoECMAECMA
extended
egrep
awk
YESstringstringnonono
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 YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESECMA
awk
ECMA
extended
egrep
awk
YESstringstringnoYESYES
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 V2nonononono8YESnoYES7.0YESYESYESYES2.0noECMA
1.42
nononononono
Line break \R Matches the next line control character U+0085 V2n/an/an/an/an/a8YESn/aYES7.0YESYESYESYES2.0n/aECMA
1.54
n/an/an/an/an/an/a
Line break \R CRLF line breaks are indivisible \R{2} and \R\R cannot match \r\n YESn/an/an/an/an/a9 noYESn/ano7.0–8.12 noYESYESXE–XE6 noYESYESn/aYESn/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 YESnonononononononononononononononononononononono
Character escape \a Match the “alert” or “bell” control character (ASCII 0x07) YESYESnononoYESYESYESYESYESYESYESYESYESYESYESawkECMA
extended
egrep
awk
YESnonononono
Character escape \b Match the “backspace” control character (ASCII 0x08) nonononononononononononononononoawknoYESnonononono
Character escape \B Match a backslash \B matches \ nonononononononononononononononononoYESnonononono
Character escape \e Match the “escape” control character (ASCII 0x1B) YESnonononoYESYESYESnoYESYESYESYESYESYESYESnoECMA
extended
egrep
awk
YESnonononono
Character escape \f Match the “form feed” control character (ASCII 0x0C) YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESECMA
awk
ECMA
extended
egrep
awk
YESnonononono
Character escape \v Match the “vertical tab” control character (ASCII 0x0B), but not any other vertical whitespace. V1 onlyYESYESYESYESYES4–7noYESnonononononoYESECMA
awk
ECMA 1.38–1.39
extended 1.38–1.89
egrep 1.38–1.89
awk 1.38–1.89
YESnonononono
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 onlynoYESYESYESYESYESYESnoYESYESYESYESYESYESYESECMAECMA
extended
egrep
awk
YESnonononono
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 onlynoYESYESYESYESnoYESnoYESYESYESYESYESYESYESECMAECMA
extended
egrep
awk
YESnonononono
NULL escape \0 Match the NULL character noYESYESYESYESYESnonoYESYESYESYESYESYESYESYESECMAYESYESnonononono
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 V2nonononononononoYES8.34YES5.5.10XE73.0.3nonononononononono
Octal escape \1 through \7 Matches the character at the specified position in the ASCII table \7 matches the “bell” character nonowithout /uYESnoECMAnonononononononononoawknonononononono
Octal escape \10 through \77 Matches the character at the specified position in the ASCII table \77 matches ? nonowithout /uYESnoYESnonoYESYESYESYESYESYESYESYESawknoYESnonononono
Octal escape \100 through \177 Matches the character at the specified position in the ASCII table \100 matches @ noYESwithout /uYESnoYESnonoYESYESYESYESYESYESYESYESawknoYESnonononono
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 noYESwithout /uYESno2.0nonoYESYESYESYESYESYESYES1.8 only failawknoYESnonononono
Octal escape \400 through \777 Matches the character at the specified position in the active code page \777 matches ǿ when using Unicode no3.5 errornonononon‑ECMA
1.0–1.1 fail
nonoYESYES6.7YESYESYESYES1.8 only failawkno8.4–8.5nonononono
Octal escape \01 through \07 Matches the character at the specified position in the ASCII table \07 matches the “bell” character V1 onlyYESwithout /uYESnoYESYESYESYESYESYESYESYESYESYESYESawkYESYESnonononono
Octal escape \010 through \077 Matches the character at the specified position in the ASCII table \077 matches ? V1 onlyYESwithout /uYESnoYESYESYESYESYESYESYESYESYESYESYESawkYESYESnonononono
Octal escape \0100 through \0177 Matches the character at the specified position in the ASCII table \0100 matches @ V1 onlynononononoYESYESnononononononononoYESnononononono
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 onlynononononoYESYESnononononononononoYESnononononono
Octal escape \0400 through \0777 Matches the character at the specified position in the active code page \0777 matches ǿ when using Unicode nononononononononononononononononoYESnononononono
FeatureSyntaxDescriptionExampleJGsoft Python JavaScript VBScript XRegExp .NET Java ICU RE2 Perl PCRE PCRE2 PHP Delphi R Ruby std::regex Boost Tcl POSIX GNU Oracle XML XPath

Ad-Free Access and Printable PDF Download

If you find the content on this website helpful they you may want a copy you can read offline or even print, or browse the site as often as you want without ads. You can purchase your own copy of the Regular-Expressions.info printable PDF download. As a bonus, you'll get a lifetime of advertisement-free access to this site!