【发布时间】:2010-06-09 16:55:10
【问题描述】:
Visual Studio 使用这种奇怪的语法有什么原因吗(例如在搜索/替换对话框中)?
我必须写:b*{:a+} = new Process\(\),而不是写\s*(\w+) = new Process\(\)。
我一直在为这种语法苦苦挣扎——尤其是因为普通的 .NET 语法是前一种语法。
这是两种语法之间的不完整比较:
What Visual .NET Comment
Studio
----------------------------------------------------------------
Tab/Spaces :b \s Either tab or space
Alphanumeric :a \w ([a-zA-Z0-9])
Subexpression {} ()
Substitution \n $n Substitutes the substring matched
by a numbered subexpression.
Backreference \n \n Matches the value of a numbered
subexpression.
----------------------------------------------------------------
请参阅此处(Visual Studio、C#)了解更多信息。
这有什么原因吗?是历史的吗?有什么优势吗?
【问题讨论】:
-
链接到从奇怪到正常语法的转换表:msdn.microsoft.com/en-us/library/2k3te2cs(v=vs.110).aspx
标签: regex visual-studio-2008 syntax