日期:2014-05-17  浏览次数:20559 次

正则取图片地址问题?
<meta property="og:image" content="http://192.168.1.100:8080//upload/C/PREW_CIE185944.JPG"/>

GetRegValue("<meta" + @"\s+" + "property=\"og:image\"" + @"\s+" + "content=\"(?<content>[^\"" + @"\<\>" + "]*)\"", jg1)

我这不知道错在那里了,取不到图片地址:http://192.168.1.100:8080//upload/C/PREW_CIE185944.JPG



------解决方案--------------------
string sql=@" <meta property=""og:image"" content=""http://192.168.1.100:8080//upload/C/PREW_CIE185944.JPG""/>";
sql=Regex.Replace(sql,@"\t|\r|\n|\s","");
Regex reg = new Regex(@"\<metaproperty\=""og\:image""content\=""(.*)""\/\>");
string reval = reg.Match(sql).Groups[1].Value;
------解决方案--------------------
string temp = @"<meta property=""og:image"" content=""http://192.168.1.100:8080//upload/C/PREW_CIE185944.JPG""/>";
Response.Write(Regex.Match(temp, @"(?<=content=\"")[^""]+(?="")").Value);
------解决方案--------------------
你正则太乱了。