In computing and telecommunication, an escape character is a single character designated to invoke an alternative interpretation on immediately subsequent characters in a character sequence. The term escape sequence refers to the escape character and the character or characters whose meaning is modified.
Many modern programming languages specify the
doublequote character (
") as a delimiter for a string literal. The backslash
\) escape character provides two ways to include
doublequotes inside a string literal, either by modifying the
meaning of the doublequote character embedded in the string
"), or by modifying the
meaning of the three characters that are the hexadecimal value of a
doublequote character (
print "Nancy said "Hello World!" to the crowd.";
produces a syntax error, whereas:
print "Nancy said \"Hello World!\" to the crowd."; ### example of \"
produces the intended output. Another alternative:
print "Nancy said \x22Hello World!\x22 to them."; ### example of \x22
uses numeric escape-sequence of hexadecimal "x22" for a quotemark.
Some programming languages also provide other ways to prevent this type of error, without requiring an escape character (see e.g. delimiter collision).
In Bourne shell
(sh), the asterisk
*) is a wildcard character expanded via globbing.
Without a preceding escape character, it will expand to the names
of all files in the working directory that don't start
with a period if and only if there are such files, otherwise
* remains unexpanded. So to refer to a file literally
called "*", the shell must be told not to interpret it in this way,
by preceding it with a backslash (
\). This modifies
the interpretation of the asterisk (
rm * # delete all files in the current directory rm \* # delete the file named *
The Windows command-line interpreter uses a caret character (
escape reserved characters that have special meanings (in
& | ( ) < > ^). The DOS command-line
interpreter, though it supports similar syntax, does not
For example, on the Windows Command Prompt, this will result in a syntax error.
whereas this will output the string:
Early reference to this term is found in Bob Bemer's IBM technical publications.
The Escape key is usually found on standard PC keyboards. However it is commonly absent from keyboards for PDAs and other devices not designed primarily for ASCII communications, and not generally used as part of the common user interface for applications on the Windows operating system. The DEC VT220 series was one of the few popular keyboards that did not have a dedicated Esc key, instead using one of the keys above the main keypad.