List down a list of the escape characters in C#



The following is the list of escape characters in C# −

Escape character Description Pattern
\a Matches a bell character, \u0007. \a
\b In a character class, matches a backspace, \u0008. [\b]{3,}
\t Matches a tab, \u0009. (\w+)\t
\r Matches a carriage return, \u000D. (\r is not equivalent to the newline character,
.)
\r
(\w+)
\v Matches a vertical tab, \u000B. [\v]{2,}
\f Matches a form feed, \u000C. [\f]{2,}

Matches a new line, \u000A. \r
(\w+)
\e Matches an escape, \u001B. \e

nn
Uses octal representation to specify a character (nnnconsists of up to three digits). \w\040\w
\x nn Uses hexadecimal representation to specify a character (nn consists of exactly two digits). \w\x20\w
\c X\c x Matches the ASCII control character that is specified by X or x, where X or x is the letter of the control character. \cC
\u nnnn Matches a Unicode character by using hexadecimal representation (exactly four digits, as represented by nnnn). \w\u0020\w
\ When followed by a character that is not recognized as an escaped character, matches that character. \d+[\+-x\*]\d+\d+[\+-x\*\d+
Updated on: 2020-06-21T12:34:14+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements