Replacement Strings Reference: Characters (original) (raw)
Feature
Syntax
Description
Example
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 !
no
no
YES
YES
extended
no
no
YES
no
no
no
3.7–3.10 error
no
sed
YES
no
no
error
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 \!
YES
YES
no
no
default
YES
YES
no
YES
YES
YES
YES
YES
default
no
YES
YES
error
Trailing backslash
A backslash at the end of the replacement string is a literal backslash.
Replacing with \ yields \
YES
YES
error
error
default
YES
YES
no
YES
YES
YES
error
YES
default
YES
YES
YES
error
\\
A backslash escapes itself.
Replacing with \\ yields \
YES
no
YES
YES
extended
YES
YES
YES
no
no
no
YES
YES
sed
YES
YES
YES
YES
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! yields !yields!
YES
YES
error
error
error
YES
YES
YES
YES
YES
error
YES
YES
YES
YES
YES
YES
error
Trailing dollar
A dollar sign at the end of the replacement string is a literal dollar sign.
Replacing with $ yields $
YES
YES
error
error
error
YES
YES
YES
YES
YES
2–4
YES
YES
default VC’15–VC’22
sed VC’08–VC’22
YES
YES
YES
error
Adollarsignescapesitself.ReplacingwithA dollar sign escapes itself.
Replacing withAdollarsignescapesitself.Replacingwith yields $
YES
YES
error
error
YES
no
YES
no
YES
YES
YES
no
no
default
all
default
no
no
error
\$
A backslash escapes a dollar sign.
Replacing with \$ yields $
YES
no
YES
YES
extended
YES
YES
YES
no
no
no
3.7–3.10 error
no
sed
YES
no
no
YES
\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
YES
no
no
YES
extended
string
no
string
string
no
string
string
string
string
YES
string
no
error
\uFFFF where FFFF are 4 hexadecimal digits
Inserts a specific Unicode code point.
\u00E0 inserts à encoded as U+00E0 only. \u00A9 inserts ©
YES
no
string
no
extended error
no
no
string
string
no
string
string
1.9 string
string
no
string
no
error
\u{FFFF} where FFFF are 1 to 4 hexadecimal digits
Inserts a specific Unicode code point.
\u{E0} inserts à encoded as U+00E0 only. \u{A9} inserts ©
V2
no
no
no
extended error
7.0.0 string
no
string
string
no
string
3.7–3.10 error
1.9 string
no
no
no
no
error
\x{FFFF} where FFFF are 1 to 4 hexadecimal digits
Inserts a specific Unicode code point.
\x{E0} inserts à encoded as U+00E0 only. \x{A9} inserts ©
YES
no
no
YES
extended
no
no
no
no
no
no
3.7–3.10 error
no
no
YES
no
no
error
\n, \r and \t
Insert an LF character, CR character and a tab character respectively
\r\n inserts a Windows CRLF line break
YES
no
string
YES
extended
string
no
string
string
no
string
YES
string
string
YES
string
no
error
\a
Insert the “alert” or “bell” control character (ASCII 0x07)
no
no
no
YES
extended
no
no
no
no
no
no
YES
no
no
YES
no
no
error
\b
Insert the “backspace” control character (ASCII 0x08)
no
no
no
YES
extended error
no
no
no
no
no
no
YES
no
no
no
no
no
error
\e
Insert the “escape” control character (ASCII 0x1B)
no
no
no
YES
extended
no
no
no
no
no
no
3.7–3.10 error
no
no
YES
no
no
error
\f
Insert the “form feed” control character (ASCII 0x0C)
no
no
no
YES
extended
no
no
no
no
no
no
YES
no
no
YES
no
no
error
\v
Insert the “vertical tab” control character (ASCII 0x0B)
no
no
no
no
extended error
no
no
no
no
no
no
YES
no
no
YES
no
no
error
\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
no
no
no
YES
extended
no
no
no
no
no
no
no
no
no
YES
no
no
no
\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
no
no
no
YES
extended
no
no
no
no
no
no
no
no
no
YES
no
no
no
\0
Insert the NULL character
no
no
no
YES
extended error
no
no
no
no
no
no
YES
no
no
all
default
no
no
error
\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
V2
no
no
5.14
extended
no
no
no
no
no
no
3.7–3.10 error
no
no
no
no
no
error
\10 through \77
Inserts the character at the specified position in the ASCII table
\77 inserts ?
no
no
no
YES
extended error
no
no
no
no
no
no
no
no
no
no
no
no
error
\100 through \177
Inserts the character at the specified position in the ASCII table
\100 inserts @
no
no
no
YES
extended error
no
no
no
no
no
no
YES
no
no
no
no
no
error
\200 through \377
Inserts the character at the specified position in the active code page
\377 inserts ÿ when using the Latin-1 code page
no
no
no
YES
extended error
no
no
no
no
no
no
YES
no
no
no
no
no
error
\400 through \777
Inserts the character at the specified position in the active code page
\777 inserts ǿ when using Unicode
no
no
no
YES
extended error
no
no
no
no
no
no
no
no
no
no
no
no
error
\01 through \07
Inserts the character at the specified position in the ASCII table
\07 inserts the “bell” character
no
no
no
YES
extended error
no
no
no
no
no
no
YES
no
no
all
default
no
no
error
\010 through \077
Inserts the character at the specified position in the ASCII table
\077 inserts ?
no
no
no
YES
extended error
no
no
no
no
no
no
YES
no
no
all
default
no
no
error
Feature
Syntax
Description
Example