正则表达式如何提取值?
正则表达式如何提取值<$if:classid value="1">
<li><a href="{#URL}" target="_blank" title="{uTitle}">{#sTitle}</a></li>
<$else>
<li>{#sTitle}(欢迎)</li>
</$if>
我想提取数 classid 1
以及
<li><a href="{#URL}" target="_blank" title="{uTitle}">{#sTitle}</a></li>
和
<li>{#sTitle}(欢迎)</li>
Regex reg = new Regex(@"(?is)<\$if:(?<name>.*?)\s+value=""(?<value>.*?)"">(\\s*?<li1>.*)<$else>(\\s*?<li2>.*^($if))</\$if>");
MatchCollection mc = reg.Matches(mass);
int shtml = mc.Count;
foreach (Match match in mc)
{
string name = match.Groups["name"].Value.Trim();
string value = match.Groups["value"].Value.Trim();
string li1 = match.Groups["li1"].Value.Trim();
string li2 = match.Groups["li2"].Value.Trim();
//System.Web.HttpContext.Current.Response.Write(name + "<br/>");
//System.Web.HttpContext.Current.Response.Write(value + "<br/>");
} 我这样写了 提取不出来