Escape Sequences
Escape sequences, also called string sequences when found inside string literals, are sequences of characters with a special meaning. Most of the time, the literal value of the character displayed is its meaning, while, sometimes, there are other hidden meanings.
Escape sequences are dedicated to a technology, and they are rarely the same between two technologies, or even, between two engines dedicated to that technology.
Here are some examples of escape sequences from PHP:
\n: new line\t: horizontal tabulation"\"": double quote, inside a double quoted-string\'This is not an escape sequence: single-quoted strings do not recognize this\u{01f418}: a unicode codepoint, representing an elephpant\200: a character in octal notation\x69: a character in hexadecimal notation
Here are some examples of escape sequences from HTML:
- ยด, an acute accent
- ", double quote
- There are many more of them. See external links.
Escape sequences should not be confused with escape characters, though they are related: some escape sequences are introduced by an escape character. Others rely on a format.
<?php
// \1 is an escape sequence that represents the first capturing parenthsis.
// It is a special meaning for REGEX.
preg_match('/(.)\1/', $string);
// Displays AA
echo "A\101";
?>