Appendix E: Escape sequences
Escape sequences can be used inside of strings, match/touch tokens and character-classes to encode any unicode character. They are introduced with a backslash.
Escape-sequences should be used to simplify the source code and its readability, but any unicode character can also be directly expressed.
Sequence | Description | Examples |
---|---|---|
\a \b \f \n \r \t \v | Bell (alert), backspace, formfeed, new line, carriage return, horizontal tab, vertical tab, | "\a\b\f\n\r\t\v" |
\' \" \\ | Quotation marks, backslash | "\'\"\\" # '"\ |
\ooo | ASCII character in octal notation | "\100" # @ |
\xhh | ASCII character in hexadecimal notation | "\xCA" # Ê |
\uhhhh | 16-Bit Unicode character in hexadecimal notation | "\u20ac" # € |
\Uhhhhhhhh | 32-Bit Unicode character in hexadecimal notation | "\U0001F98E" # 🦎 |