网络编程 发布日期:2025/11/6 浏览次数:1
原文符号
因为"htmlcode">
string pattern1 = @"a.*c"; // greedy match
Regex regex = new Regex(pattern1);
regex.Match("abcabc"); // return "abcabc"
非贪婪匹配
在满足匹配时,匹配尽可能短的字符串,使用"htmlcode">
string pattern1 = @"a.*"; // non-greedy match
Regex regex = new Regex(pattern1);
regex.Match("abcabc"); // return "abc"
几个常用的非贪婪匹配Pattern
*"htmlcode">
while(<>){
if(/("Fred wants a $1\n" ;
}
}