文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Escape Sequences

Escape Sequences

时间:2006-08-06  来源:sosogh

1.存在的范围: string constants ("foo") or regexp constants 2.特定的Escape Sequences \\ A literal backslash, `\'.


\a The “alert” character, Ctrl-g, ASCII code 7 (BEL). (This usually makes some sort of audible noise.)


\b Backspace, Ctrl-h, ASCII code 8 (BS).


\f Formfeed, Ctrl-l, ASCII code 12 (FF).


\n Newline, Ctrl-j, ASCII code 10 (LF).


\r Carriage return, Ctrl-m, ASCII code 13 (CR).


\t Horizontal TAB, Ctrl-i, ASCII code 9 (HT).


\v Vertical tab, Ctrl-k, ASCII code 11 (VT).


\nnn The octal value nnn, where nnn stands for 1 to 3 digits between `0' and `7'. For example, the code for the ASCII ESC (escape) character is `\033'.


\xhh... The hexadecimal value hh, where hh stands for a sequence of hexadecimal digits (`0'–`9', and either `A'–`F' or `a'–`f'). Like the same construct in ISO C, the escape sequence continues until the first nonhexadecimal digit is seen. However, using more than two hexadecimal digits produces undefined results. (The `\x' escape sequence is not allowed in POSIX awk.)


\/ A literal slash (necessary for regexp constants only). This expression is used when you want to write a regexp constant that contains a slash. Because the regexp is delimited by slashes, you need to escape the slash that is part of the pattern, in order to tell awk to keep processing the rest of the regexp.


\" A literal double quote (necessary for string constants only). This expression is used when you want to write a string constant that contains a double quote. Because the string is delimited by double quotes, you need to escape the quote that is part of the string, in order to tell awk to keep processing the rest of the string.

gawk特定的Escape Sequences

\w Matches any word-constituent character—that is, it matches any letter, digit, or underscore. Think of it as shorthand for [[:alnum:]_].


\W Matches any character that is not word-constituent. Think of it as shorthand for [^[:alnum:]_].


\< Matches the empty string at the beginning of a word. For example, /\<away/ matches `away' but not `stowaway'.


\> Matches the empty string at the end of a word. For example, /stow\>/ matches `stow' but not `stowaway'.


\y Matches the empty string at either the beginning or the end of a word (i.e., the word boundary). For example, `\yballs?\y' matches either `ball' or `balls', as a separate word.


\B Matches the empty string that occurs between two word-constituent characters. For example, /\Brat\B/ matches `crate' but it does not match `dirty rat'. `\B' is essentially the opposite of `\y'.

There are two other operators that work on buffers. In Emacs, a buffer is, naturally, an Emacs buffer. For other programs, gawk's regexp library routines consider the entire string to match as the buffer. The operators are: \` Matches the empty string at the beginning of a buffer (string).


\' Matches the empty string at the end of a buffer (string).
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载