110,538
社区成员
发帖
与我相关
我的任务
分享
string str = @" <img src=http://images.gg-art.com/auction/images1/13/13325.jpg >
<img src=http://images.gg-art.com/auction/images1/13/13326.jpg >
<img src=http://images.gg-art.com/auction/images1/13/13327.jpg >";
Regex r = new Regex(@"<img[\s]*src[\s]*=(?<src>http://[\w\W]*.jpg)[\s]*>$", RegexOptions.Multiline);
string oStr = "";
if (r.IsMatch(str))
{
oStr += r.Match(str).Groups["src"].Value.ToString()+",";
}
Response.Write(oStr);
string str =
@"<img src=http://images.gg-art.com/auction/images1/13/13325.jpg >
<img src=http://images.gg-art.com/auction/images1/13/13326.jpg >
<img src=http://images.gg-art.com/auction/images1/13/13327.jpg >";
Regex r = new Regex(@"<img\s+src\s*=\s*(?<src>[^\>]*?)\s*>");
string oStr = "";
foreach(Match vMatch in r.Matches(str))
{
oStr += vMatch.Result("${src}") + ",";
}
string str = @" <img src=http://images.gg-art.com/auction/images1/13/13325.jpg > <img src=http://images.gg-art.com/auction/images1/13/13326.jpg > <img src=http://images.gg-art.com/auction/images1/13/13327.jpg >";
string pattern = @"<img\ssrc=([^\s]*).*?>";
//Regex r = new Regex(@"<img[\s]*src[\s]*=(?<src>http://[\w\W]*.jpg)[\s]*>$", RegexOptions.Multiline);
Regex r = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
//string oStr = "";
bool isMatch = r.IsMatch(str);
if (isMatch)
{
MatchCollection mc = r.Matches(str);
foreach (Match m in mc)
{
Response.Write(m.Groups[1].Value + "<br />");
}
}