\a 报警字符
\b 通常是单词边界,但是在一个字符集合中它表示退格键
\t 制表符
34 \r 回车
\v 垂直制表符
\f 分页符
35 \n 换行符
\e ESC
36 \nnn ASCII码八进制数为nnn的字符
37 \xnn 十六进制数为nn的字符
38 \unnnn Unicode码为nnnn的字符
39 \cN Control N字符,例如回车(Ctrl-M)就是\cM
40 \A 字符串的开始(像^但是不依赖于多行选项)
41 \Z 字符串的结尾或者\n之前的字符串结尾(忽略多行)
\z 字符串结尾(忽略多行)
42 \G 当前搜索的开始阶段
43 \p{name} 命名为name的Unicode类中的任何字符,例如\p{IsGreek}
(?>exp) 贪婪子表达式,也被称为非回溯子表达式。它只匹配一次然后就不再参与回溯。
44 (?<x>-<y>exp) or (?-<y>exp) Balancing group. This is complicated but powerful. It allows named capture groups to be manipulated on a push down/pop up stack and can be used, for example, to search for matching parentheses, which is otherwise not possible with regular expressions. See the example in the project file.
45 (?im-nsx:exp) 正则表达式选项为子表达式exp
46 (?im-nsx) Change the regular expression options for the rest of the enclosing group
(?(exp)yes|no) The subexpression exp is treated as a zero-width positive lookahead. If it matches at this point, the subexpression yes becomes the next match, otherwise no is used.
(?(exp)yes) Same as above but with an empty no expression
(?(name)yes|no) This is the same syntax as the preceding case. If name is a valid group name, the yes expression is matched if the named group had a successful match, otherwise the no expression is matched.
47 (?(name)yes) Same as above but with an empty no expression
测试字符串的某个模式。例如,可以对一个输入字符串进行测试,看在该字符串是否存在一个电话号码模式或一个信用卡号码模式。这称为数据有效性验证。
替换文本。可以在文档中使用一个正则表达式来标识特定文字,然后可以全部将其删除,或者替换为别的文字。
根据模式匹配从字符串中提取一个子字符串。可以用来在文本或输入字段中查找特定文字。
例如,假如需要搜索整个 web 站点来删除某些过时的材料并替换某些Html 格式化标记,则可以使用正则表达式对每个文件进行测试,看在该文件中是否存在所要查找的材料或 HTML 格式化标记。用这个方法,就可以将受影响的文件范围缩小到包含要删除或更改的材料的那些文件。然后可以使用正则表达式来删除过时的材料,最后,可以再次使用正则表达式来查找并替换那些需要替换的标记。
9. ^\d{3}-\d{4}$ -- Validate a seven-digit phone number
这是和第5个例子一样的,但是强迫它符合整个文本字符串,匹配文本的头尾之外没有其他字符。通过在.NET中设置“Multiline”选项,“^”和“$”改变他们的意义为匹配一行文本的起点和结束,而不是整个正文字符串。Expresso的例子使用这个选项。