List down a list of the escape characters in C#


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

Escape characterDescriptionPattern
\aMatches a bell character, \u0007.\a
\bIn a character class, matches a backspace, \u0008.[\b]{3,}
\tMatches a tab, \u0009.(\w+)\t
\rMatches a carriage return, \u000D. (\r is not equivalent to the newline character,
.)
\r
(\w+)
\vMatches a vertical tab, \u000B.[\v]{2,}
\fMatches a form feed, \u000C.[\f]{2,}

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

nn
Uses octal representation to specify a character (nnnconsists of up to three digits).\w\040\w
\x nnUses hexadecimal representation to specify a character (nn consists of exactly two digits).\w\x20\w
\c X\c xMatches the ASCII control character that is specified by X or x, where X or x is the letter of the control character.\cC
\u nnnnMatches 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: 21-Jun-2020

645 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements