Quick Start
Tutorial
Search & Replace
Tools & Languages
Examples
Reference
Replacement Reference
Introduction
Table of Contents
Characters
Matched Text & Backreferences
Case Conversion
Context
Conditionals
Regular Expressions Reference
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!

Replacement String Characters

FeatureSyntaxDescriptionExampleJGsoft Python JavaScript VBScript XRegExp .NET Java ICU RE2 Perl PCRE2 PHP Delphi R Ruby std::regex Boost Tcl Oracle XPath
Backslash Backslash followed by any character that does not form a token A backslash that is followed by any character that does not form a replacement string token in combination with the backslash inserts the escaped character literally. Replacing with \! yields ! no3.7 errornonononoYESYESerrorYESextendednonoYESnosedYESnonoerror
Backslash A backslash that does not form a token A backslash that is not part of a replacement string token is a literal backslash. Replacing with \! yields \! YESYESYESYESYESYESnonoerrornodefaultYESYESnoYESdefaultnoYESYESerror
Backslash Trailing backslash A backslash at the end of the replacement string is a literal backslash. Replacing with \ yields \ YESerrorYESYESYESYESerrornoerrorerrordefaultYESYESnoYESdefaultYESYESYESerror
Backslash \\ A backslash escapes itself. Replacing with \\ yields \ YESYESnonononoYESYESYESYESextendedYESYESYESYESsedYESYESYESYES
Dollar A dollar that does not form a token A dollar sign that does not form a replacement string token is a literal dollar sign. Replacing with $! yields $! YESYESYESYESerrorYESerrorerrorYESerrorerrorYESYESYESYESYESYESYESYESerror
Dollar Trailing dollar A dollar sign at the end of the replacement string is a literal dollar sign. Replacing with $ yields $ YESYESYESYESerrorYESerrorerrorYESerrorerrorYESYESYESYESdefault VC’15
sed VC’10
YESYESYESerror
Dollar $$ A dollar sign escapes itself. Replacing with $$ yields $ YESnoYESYESYESYESerrorerrornoerrorYESnoYESnonodefaultall
default
nonoerror
Dollar \$ A backslash escapes a dollar sign. Replacing with \$ yields $ YES3.7 errornonononoYESYESerrorYESextendedYESYESYESnosedYESnonoYES
Hexadecimal escape \xF where F is a single hexadecimal digit Inserts the character at the specified position in the ASCII table \xA inserts a line feed control character no3.7 errornonononononoerrorYESextendedstringnostringstringstringYESstringnoerror
Hexadecimal escape \x7F where 7F are 2 hexadecimal digits between 00 and 7F Inserts the character at the specified position in the ASCII table \x40 inserts @ YESstringstringnostringnononoerrorYESextendedstringnostringstringstringYESstringnoerror
Hexadecimal escape \xFF where FF are 2 hexadecimal digits Inserts the character at the specified position in the code page \xA9 inserts © when using the Latin-1 code page YESstringstringnostringnononoerrorYESextendednonononostringYESstringnoerror
Unicode escape \uFFFF where FFFF are 4 hexadecimal digits Inserts a specific Unicode code point. \u00E0 inserts à. \u00A9 inserts © YESstringstringnostringnostringYESerrornoextended errornonostring1.9 stringstringnostringnoerror
Unicode escape \u{FFFF} where FFFF are 1 to 4 hexadecimal digits Inserts a specific Unicode code point. \u{E0} inserts à. \u{A9} inserts © V2nostringnostringnononoerrornono7.0.0 stringnostring1.9 stringnonononoerror
Unicode escape \u{10FFFF} where 10FFFF is a hexadecimal value between 0 and 10FFFF Inserts a specific Unicode code point. \u{1D400} inserts 𝐀 nonostringnostringnononoerrornono7.0.0 stringnono1.9 stringnonononoerror
Unicode escape \x{FFFF} where FFFF are 1 to 4 hexadecimal digits Inserts a specific Unicode code point. \x{E0} inserts à. \x{A9} inserts © YESnononononononoerrorYESextendednononononoYESnonoerror
Unicode escape \x{10FFFF} where 10FFFF is a hexadecimal value between 0 and 10FFFF Inserts a specific Unicode code point. \x{1D400} inserts 𝐀 nonononononononoerrorYESextendednonononononononoerror
Unicode escape \U0010FFFF where 0010FFFF are 8 hexadecimal digits between 00000000 and 0010FFFF Inserts a specific Unicode code point. \U0001D400 inserts 𝐀 nostringnononononoYESnonostringnonostringnostringno8.6 stringnoerror
Character escape \n, \r and \t Insert an LF character, CR character and a tab character respectively \r\n inserts a Windows CRLF line break YESYESstringnostringnostringnoerrorYESextendedstringnostringstringstringYESstringnoerror
Character escape \a Insert the “alert” or “bell” control character (ASCII 0x07) noYESnonononononoerrorYESextendednononononoYESnonoerror
Character escape \b Insert the “backspace” control character (ASCII 0x08) noYESnonononononoerrorYESextended
10.45
nonononononononoerror
Character escape \e Insert the “escape” control character (ASCII 0x1B) no3.7 errornonononononoerrorYESextendednononononoYESnonoerror
Character escape \f Insert the “form feed” control character (ASCII 0x0C) noYESnonononononoerrorYESextendednononononoYESnonoerror
Character escape \v Insert the “vertical tab” control character (ASCII 0x0B) noYESnonononononoerrornoextended
10.45
nononononoYESnonoerror
Control character escape \cA through \cZ Insert an ASCII character Control+A through Control+Z, equivalent to \x01 through \x1A \cM\cJ inserts a Windows CRLF line break no3.7 errornonononononoerrorYESextendednononononoYESnonoerror
Control character escape \ca through \cz Insert an ASCII character Control+A through Control+Z, equivalent to \x01 through \x1A \cm\cj inserts a Windows CRLF line break no3.7 errornonononononoerrorYESextendednononononoYESnonoerror
NULL escape \0 Insert the NULL character noYESnononononononoYESextended
10.45
nononononoall
default
nonoerror
Octal escape \o{7777} where 7777 is any octal number Inserts the character at the specified position in the active code page \o{20254} inserts when using Unicode V23.7 errornonononononoerrorYESextendednonononononononoerror
Octal escape \10 through \77 Inserts the character at the specified position in the ASCII table \77 inserts ? nononononononononoYESextended
10.45
nonononononononoerror
Octal escape \100 through \177 Inserts the character at the specified position in the ASCII table \100 inserts @ noYESnononononononoYESextended
10.45
nonononononononoerror
Octal escape \200 through \377 Inserts the character at the specified position in the active code page \377 inserts ÿ when using the Latin-1 code page noYESnononononononoYESextended
10.45
nonononononononoerror
Octal escape \400 through \777 Inserts the character at the specified position in the active code page \777 inserts ǿ when using Unicode nononononononononoYESextended
10.45
nonononononononoerror
Octal escape \01 through \07 Inserts the character at the specified position in the ASCII table \07 inserts the “bell” character noYESnononononononoYESextended
10.45
nononononoall
default
nonoerror
Octal escape \010 through \077 Inserts the character at the specified position in the ASCII table \077 inserts ? noYESnononononononoYESextended
10.45
nononononoall
default
nonoerror
Octal escape \0100 through \0177 Inserts the character at the specified position in the ASCII table \0100 inserts @ nonononononononononoextended
10.21–10.44 error
nononononoall
default
nonoerror
Octal escape \0200 through \0377 Inserts the character at the specified position in the active code page \0377 inserts ÿ when using the Latin-1 code page nonononononononononoextended
10.21–10.44 error
nononononoall
default
nonoerror
Octal escape \0400 through \0777 Inserts the character at the specified position in the active code page \0777 inserts ǿ when using Unicode nonononononononononoextended
10.21–10.44 error
nononononoall
default
nonoerror
FeatureSyntaxDescriptionExampleJGsoft Python JavaScript VBScript XRegExp .NET Java ICU RE2 Perl PCRE2 PHP Delphi R Ruby std::regex Boost Tcl Oracle XPath