我有以下几行:
d:\Projects\qqq\Development\qqq.MySol1.sln
d:\Projects\qqq\qqqDevelopment\qqqMySol2.sln
d:\Projects\qqq\Development\MyInstaller.sln
d:\Projects\qqq\qqq\Development\MyInstaller.sln
d:\Projects\Development\MyInstaller.sln
我需要一个能够导致名称捕获的正则表达式:
Line 1: Development and MySol1.sln
Line 2: Development and MySol2.sln
Line 3: Development and MyInstaller.sln
Line 4: Development and MyInstaller.sln
Line 5: Development and MyInstaller.sln
这样一个正则表达式将从行中删除(忽略)单词qqq
。
我一直在尝试使用The Regulator,并有一个部分解决方案:
.*\\(?<A>.*)\\.{3}(?<B>.*)
这导致:
Line 1: Development and .MySol1.sln
Line 2: qqqDevelopment and MySol2.sln
Line 3: Development and nstaller.sln
Line 4: Development and nstaller.sln
Line 5: Development and nstaller.sln
所以.{3}
应该以某种方式修复。
答案 0 :(得分:0)
我认为应该有效:
.*\\(?:qqq)?(?<A>.*)\\(?:qqq)?(?<B>.*)