我有以下幾行:
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從行。 我一直在試圖與調節,并有部分的解決方案:
.*\\(?<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}應固定
1.我認為,應該工作:
.*\\(?:qqq)?(?<A>.*)\\(?:qqq)?(?<B>.*)