求一正则
本帖最后由 liutao132 于 2013-01-10 10:33:27 编辑 <p style="text-align: center">
<strong><img alt="求一正则解决办法" src="http://2e.zol-img.com.cn/product/103_500x2000/516/ceuOQXwFxHFs.jpg" style="height: 225px; width: 300px" /><br />
整机平台</strong></p>
现在想获取 红色里面的两个数字,谢谢!!!
[解决办法]
string tempStr = File.ReadAllText(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312"));//读取txt
Match match = Regex.Match(tempStr,@"(?i)<img[^>]*?height:\D+?(\d+)[^>]*?width:\D+(\d+)");
string height = match.Groups[1].Value;//225
string width = match.Groups[2].Value;//300