在.NET Framework 开发人员指南 的 字符转义 一节 有这样一段话。
除 .$ ^ { [ ( | ) * + ? \ 外,其他字符与自身匹配。
但是其中并未注明这些字符应该匹配为什么字符。
为了方便自己以后查阅,也为了方便网友搜索我就写在这里了。
[Sipo]
点的转义:. ==> \\u002E
美元符号的转义:$ ==> \\u0024
乘方符号的转义:^ ==> \\u005E
左大括号的转义:{ ==> \\u007B
左方括号的转义:[ ==> \\u005B
左圆括号的转义:( ==> \\u0028
竖线的转义:| ==> \\u007C
右圆括号的转义:) ==> \\u0029
星号的转义:* ==> \\u002A
加号的转义:+ ==> \\u002B
问号的转义:? ==> \\u003F
反斜杠的转义:\ ==> \\u005C
The following code example uses named grouping constructs to capture substrings from a string containing data in a "DATANAME:VALUE" format that the regular expression splits at the colon (:).
Regex r = new Regex("^(?<name>\\w+):(?<value>\\w+)");
Match m = r.Match("Section1:119900");
This regular expression returns the following output
m.Groups["name"].Value = “Section1″
m.Groups["value"].Value = “119900″
参:http://msdn2.microsoft.com/en-us/library/30wbz966.aspx
好文章!
I just want to say I am newbie to blogging and site-building and really liked this web site. Most likely I’m likely to bookmark your site . You actually have fabulous stories. Many thanks for sharing your webpage.
You should take part in a contest for among the best blogs on the web. I’ll recommend this website!