Escape Sequences

Escape sequences

Characters may be specified using a escape sequences syntax much like that used in C and Perl: "\n'' matches a newline, "\t'' a tab, etc. More generally, \xnn, where nn is a string of hexadecimal digits, matches the character whose ASCII value is nn. If You need wide (Unicode) character code, You can use '\x{nnnn}', where 'nnnn' - one or more hexadecimal digits.

  \xnn     char with hex code nn

  \x{nnnn} char with hex code nnnn (one byte for plain text and two bytes for Unicode)

  \t       tab (HT/TAB), same as \x09

  \n       newline (NL), same as \x0a

  \r       car.return (CR), same as \x0d

  \f       form feed (FF), same as \x0c

  \a       alarm (bell) (BEL), same as \x07

  \e       escape (ESC), same as \x1b

 

Examples:

  foo\x20bar   matches 'foo bar' (note space in the middle)

  \tfoobar     matches 'foobar' predefined by tab

0 Comments

Article is closed for comments.
Powered by Zendesk