最上面加
using System.Text.RegularExpressions;
[code=C#]
string str = @"(?<=<img[^>]+src="")[^""]+";
Regex r = new Regex(str, RegexOptions.IgnoreCase);
Match m = r.Match("html代码");
while (m.Success)
{
s.Add(m.Value.ToString());
m = m.NextMatch();
}
System.Text.RegularExpressions.Regex reg=new System.Text.RegularExpressions.Regex("<img\\s*src=(['\"])([^\\1]*)\\1[^>]*",System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.MatchCollection m = reg.Matches(str);
for (int i = 0; i < m.Count; i++) s.Add(m[i].Groups["value"].ToString());
[Quote=引用 5 楼 jack20080808 的回复:]
最上面加
using System.Text.RegularExpressions;
[code=C#]
string str = @"(? <= <img[^>]+src="")[^""]+";
Regex r = new Regex(str, RegexOptions.IgnoreCase);
Match m = r.Match("html代码");
while (m.Success)
{
s.Add(m.Value.ToString());
m = m.NextMatch();
}