亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

正則表達(dá)式匹配 非XXX的行

 更新時(shí)間:2008年07月15日 22:09:18   作者:  
問(wèn)題:如何匹配"非:.+123.123.123.10.+ " 行


1111111111111 
前邊有內(nèi)容,不定123.123.123.10后邊有內(nèi)容,不定 
3333333333333 
4444444444444 


如何匹配"非:.+123.123.123.10.+ " 
行 

匹配結(jié)果是, 
1111111111111 

3333333333333 
4444444444444

結(jié)論:

^(?!.*123.123.123.10).*$ 
或C#里這么操作:

 textBox2.Text = Regex.Replace(textBox1.Text, @"\n.*123\.123\.123\.10.*\n", "\n\r\n");
string result = Regex.Replace(str, @"^.*?123\.123\.123\.10.*$", "", RegexOptions.Multiline);
Regex reg =new Regex(@"(?<=^|\r\n)(?!123\.123\.123\.10).+"); 

總結(jié):

匹配非“非內(nèi)容”的行的表達(dá)式應(yīng)該寫(xiě)成:^(?!.*非內(nèi)容).*$ 


=================================== 
另,再來(lái)個(gè)例子: 
2008-07-14 15:44:40 W3SVC491 60.27.236.4 GET /Item/How-To-Connection-My-Computer-Flow-IP-yongfa365.html - 80 - 74.6.22.106 Mozilla/5.0+(compatible;+Yahoo!+Slurp;+http://help.yahoo.com/help/us/ysearch/slurp) 200 0 0 
2008-07-14 15:44:51 W3SVC491 60.27.236.4 GET /item/Clear.bat-System-Windows-98-XP-2003-yongfa365.html - 80 - 124.73.140.102 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0) 200 0 64 
2008-07-14 15:44:51 W3SVC491 60.27.236.4 GET /item/Clear.bat-System-Windows-98-XP-2003-yongfa365.html - 80 - 124.73.140.102 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0) 206 0 64 
2008-07-14 15:47:11 W3SVC491 60.27.236.4 GET /Articles.xml - 80 - 65.214.44.28 Bloglines/3.1+(http://www.bloglines.com;+1+subscriber) 200 0 64 
2008-07-14 15:47:47 W3SVC491 60.27.236.4 GET /Item/SQL-Server-Store-More-Than-8000-WRITETEXT-UPDATETEXT-yongfa365.html - 80 - 59.125.118.13 Trend+Micro+Web+Protection+Add-On+1.10.1144 200 0 0 

找出上而面的行里的,不是以“200 0 64”結(jié)尾的行,然后刪除

^(?!.*200 0 64).*$ 

而我一直是這么測(cè)試的: 
^(?!.*200 0 64)$ 
沒(méi)有后邊的.* 因?yàn)槲矣X(jué)得后邊已經(jīng)沒(méi)有內(nèi)容了,所以沒(méi)寫(xiě) .* 而不寫(xiě)就不對(duì),寫(xiě)了才行,哪位高人可以再指點(diǎn)下。

相關(guān)文章

最新評(píng)論