我需要找到所有Response.Redirect();
的不以true, true);
結尾我認爲在Visual Studio中使用搜索正則表達式是找到這些的最佳選擇,但我不知道如何使該正則表達式。在response.redirect
可以是任何東西,但它不能結束true, true);
這些是我想找到的。用於在visual studio中搜索的正則表達式:不以true,true結束;
正則表達式的任何想法?
我需要找到所有Response.Redirect();
的不以true, true);
結尾我認爲在Visual Studio中使用搜索正則表達式是找到這些的最佳選擇,但我不知道如何使該正則表達式。在response.redirect
可以是任何東西,但它不能結束true, true);
這些是我想找到的。用於在visual studio中搜索的正則表達式:不以true,true結束;
正則表達式的任何想法?
我認爲這應該工作:
Response\.Redirect\s*\(.*?(?<!true\s*\,\s*true\s*)\);
搜索「的Response.Redirect」, - 後跟0或多個空格 - 然後是( - 後跟任意字符的序列最短 - 不會以true,true結束);
試試這個:
true, true\);$
解釋:
要匹配X和無法比擬的Y,然後嘗試:
$regex1 = '/^Response\.Redirect\(/';
$regex2 = '/true, true\);$/';
然後:
if (preg_match($regex1, $s) && !preg_match($regex2, $s)) { // match } else { // not match }
例子:
$s = 'Response.Redirect("something", true, true);'; // false
$s = 'Response.Redirect("something");'; // true
$s = '("something", true, true);'; // false
對不起PHP中的樣本。但是你可以修改邏輯的正則表達式&。
我不認爲VS搜索支持lookarounds。 (但它應該...) – stema 2012-04-19 09:01:34
感謝您的努力,但是當我使用它時,它找不到任何結果。 (即使有) – Stefanvds 2012-04-19 09:08:09
PS:你不必介意空間。它總是格式化的,所以它是真實的,真實的);你(沒有)尋找:) – Stefanvds 2012-04-19 09:13:50