我在C#程序中有以下正则表达式,并且难以理解它:
(?<=#)[^#]+(?=#)
Run Code Online (Sandbox Code Playgroud)
我会把它分解为我认为我理解的内容:
(?<=#) a group, matching a hash. what's `?<=`?
[^#]+ one or more non-hashes (used to achieve non-greediness)
(?=#) another group, matching a hash. what's the `?=`?
Run Code Online (Sandbox Code Playgroud)
所以这个问题我已经是?<=和?<组成部分.从阅读MSDN,?<name>用于命名组,但在这种情况下,尖括号永远不会关闭.
我?=在文档中找不到,搜索它真的很难,因为搜索引擎大多会忽略那些特殊的字符.