Escape Sequence

A string used to represent special characters. A backslash followed by a character represents newlines, tabs, and other control characters.

An escape sequence is a combination of an escape character (typically a backslash ) followed by one or more characters, used to represent special or control characters that cannot be typed directly.

Common escape sequences include (newline), (tab), \ (backslash), " (double quote), and A (Unicode character A). Programming fundamentals books provide a comprehensive overview of escape sequences.

In JSON, escaping double quotes and backslashes is mandatory. In HTML, character references like < and & serve as escaping mechanisms.

Escape sequences are also critical in regular expressions: . matches a literal dot, and d matches digits. Double escaping is sometimes required, adding complexity. Regular expressions introduction books explain practical escape usage.