我希望从</ut>High </df><df Font="宋体" Colour="0x0000ff">峰值扭矩</df><df Font="宋体"><ut Type="end" LeftEdge="angle" DisplayText="SPAN"></SPAN></ut> - The High Peak </df><df Font="宋体" Colour="0x0000ff">扭矩值</df><df Font="宋体"> for the </df>
中得到High 峰值扭矩- The High Peak 扭矩值for the
我写的表达式是:"\\w*>\\s*(?<text>\\w*)\\s*</df>\\w*"
可是我发现由于我给text限定为/w形,所以类似- The High Peak,for the这种有空格的句子不能搜索出来,请问我应该如何写这个正则式子能,谢谢
中得到High 峰值扭矩- The High Peak 扭矩值for the
我写的表达式是:"\\w*>\\s*(?<text>\\w*)\\s*</df>\\w*"
可是我发现由于我给text限定为/w形,所以类似- The High Peak,for the这种有空格的句子不能搜索出来,请问我应该如何写这个正则式子能,谢谢
string regexStr = @"<[^>]+>([^<>]+)<[^>]+>";
MatchCollection mc = Regex.Matches(yourStr, regexStr);
foreach(Match m in mc)
{
string tmep = m.Groups[1].Value;
}不过这个正则表达式把字符串"</SPAN>"也提了出来,需要在以后判断去除。