前面发帖问了这个问题的,这次主要是问问细节问题,兄弟们给我的代码,关于找出图片路径,代码如下:
try
{
string fckStr = FCKeditor1.Value;
Regex reg = new Regex(@"(?is)<img[^>]*?\ssrc\s*=\s*(['""]?)(?<src>[^'""\s>]+)\1[^>]*>");
MatchCollection matchs = Regex.Matches(fckStr, @"<img\s[^> ]*src=([""']*)(?<src>[^'""]*)\1[^>]*> ", RegexOptions.IgnoreCase);
foreach (Match m in matchs)
{
Response.Write("<script>alert('循环开始')</script>");//不提示
this.lblmsg.Text = m.Groups["src "].Value.ToString();//没有值,想问的是这个值怎么才能找出来呢?
}
}
catch
{
Response.Write("<script>alert('查找失败')</script>");
}
注:我测试的时候添加图片了 的,请大家 帮我看看
try
{
string fckStr = FCKeditor1.Value;
Regex reg = new Regex(@"(?is)<img[^>]*?\ssrc\s*=\s*(['""]?)(?<src>[^'""\s>]+)\1[^>]*>");
MatchCollection matchs = Regex.Matches(fckStr, @"<img\s[^> ]*src=([""']*)(?<src>[^'""]*)\1[^>]*> ", RegexOptions.IgnoreCase);
foreach (Match m in matchs)
{
Response.Write("<script>alert('循环开始')</script>");//不提示
this.lblmsg.Text = m.Groups["src "].Value.ToString();//没有值,想问的是这个值怎么才能找出来呢?
}
}
catch
{
Response.Write("<script>alert('查找失败')</script>");
}
注:我测试的时候添加图片了 的,请大家 帮我看看
Response.Write("<script>alert('循环开始')</script>");//不提示??注掉不就节了
this.lblmsg.Text = m.Groups["src "].Value.ToString();//没有值,想问的是这个值怎么才能找出来呢? ??m.Groups["src "].Value.ToString();多了一个空格??
m.Groups[0].Value.ToString();//直接写0
多个空格???