<iframe width="740" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://ditu.google.cn/maps?q=%E5%B9%BF%E5%B7%9E%E9%B9%8F%E5%B3%B0%E6%9C%AC%E7%94%B0%E5%BA%97&hl=zh-CN&cd=1&ei=YlQjTJy0MYb4uQPhosjVCA&sll=35.11111,104.111111&sspn=48.954644,61.962891&brcurrent=3,0x3403f157e2e4609f:0x303e6f47a8a2281c,0,0x3403f3f633f78ad9:0x7a30a41e1da40b9e%3B5,0,0&ie=UTF8&view=map&cid=4306157070493002983&ved=0CEAQpQY&hq=%E5%B9%BF%E5%B7%9E%E9%B9%8F%E5%B3%B0%E6%9C%AC%E7%94%B0%E5%BA%97&hnear=&ll=22.531962,114.020083&spn=0.006937,0.015879&z=16&iwloc=A&output=embed"></iframe>
用正则表达式怎么截取到sll的值
并且不能在前台截取
只能在后台截取!
14 个解决方案
#1
有多个还是一个
#2
每条数据只有一个,数据是动态的
#3
是取出35.11111,104.111111这个吗
string s6="你的字符串";
string patern = "(?<=sll=)(.*?)(?=&)";
Match match6 = Regex.Match(s6, patern,RegexOptions.None);
string resltstr = match6.Value;
#4
ssl长度固定吗?
#5
解决了,谢谢你,不小心把正则写错了
还有一个问题请教您
我要去掉一段字符串中的HTML代码,这一部分
<style>
/* Generator: eWebEditor */
p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;font-size:10.5pt;font-family:"Times New Roman";}
div.Section1 {page:Section1;}
ol {margin-bottom:0cm;}
ul {margin-bottom:0cm;}
</style>
也是在后台用正则,怎么写啊
#6
string str = @"<iframe width=""740"" height=""350"" frameborder=""0"" scrolling=""no"" marginheight=""0"" marginwidth=""0"" src=""http://ditu.google.cn/maps?q=%E5%B9%BF%E5%B7%9E%E9%B9%8F%E5%B3%B0%E6%9C%AC%E7%94%B0%E5%BA%97&hl=zh-CN&cd=1&ei=YlQjTJy0MYb4uQPhosjVCA&sll=35.11111,104.111111&sspn=48.954644,61.962891&brcurrent=3,0x3403f157e2e4609f:0x303e6f47a8a2281c,0,0x3403f3f633f78ad9:0x7a30a41e1da40b9e%3B5,0,0&ie=UTF8&view=map&cid=4306157070493002983&ved=0CEAQpQY&hq=%E5%B9%BF%E5%B7%9E%E9%B9%8F%E5%B3%B0%E6%9C%AC%E7%94%B0%E5%BA%97&hnear=&ll=22.531962,114.020083&spn=0.006937,0.015879&z=16&iwloc=A&output=embed""></iframe>";
Response.Write(Regex.Match(str, "(?is)sll=(?<val>.*?)&").Groups["val"]);
#7
string patern = "<style>(.*?)<style>";
string resltstr = Regex.Replace(htmlstr, patern, @"");
我也是新手
#8
只要去除style标签中的吗?还是全部HTML?
#9
少写过/
string patern = "<style>(.*?)</style>";
string resltstr = Regex.Replace(htmlstr, patern, @"");
#10
其他的我已经去掉了
就<style>标签中的去不掉
#11
static void Main(string[] args)
{
string str = @"<style>
/* Generator: eWebEditor */
p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;font-size:10.5pt;font-family:""Times New Roman"";}
div.Section1 {page:Section1;}
ol {margin-bottom:0cm;}
ul {margin-bottom:0cm;}
</style>
";
string re = "(?is)<style>.*?</style>";
str = Regex.Replace(str, re, "");
Console.WriteLine(str);
Console.ReadLine();
}
#12
string patern = "(?is)(?<=<style>)(.*?)(?=<//style>)";
string resltstr = Regex.Replace(htmlstr, patern, @"");
#13
是不是<style>标签也要去掉?是的话
string patern = "(?is)(?<=<style>)(.*?)(?=</style>)";
string resltstr = Regex.Replace(htmlstr, patern, @"");
去掉style标签之间的话
string patern = "<style>(.*?)</style>";
string resltstr = Regex.Replace(htmlstr, patern, @"");
#14
解决了,谢谢您!
#1
有多个还是一个
#2
每条数据只有一个,数据是动态的
#3
是取出35.11111,104.111111这个吗
string s6="你的字符串";
string patern = "(?<=sll=)(.*?)(?=&)";
Match match6 = Regex.Match(s6, patern,RegexOptions.None);
string resltstr = match6.Value;
#4
ssl长度固定吗?
#5
解决了,谢谢你,不小心把正则写错了
还有一个问题请教您
我要去掉一段字符串中的HTML代码,这一部分
<style>
/* Generator: eWebEditor */
p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;font-size:10.5pt;font-family:"Times New Roman";}
div.Section1 {page:Section1;}
ol {margin-bottom:0cm;}
ul {margin-bottom:0cm;}
</style>
也是在后台用正则,怎么写啊
#6
string str = @"<iframe width=""740"" height=""350"" frameborder=""0"" scrolling=""no"" marginheight=""0"" marginwidth=""0"" src=""http://ditu.google.cn/maps?q=%E5%B9%BF%E5%B7%9E%E9%B9%8F%E5%B3%B0%E6%9C%AC%E7%94%B0%E5%BA%97&hl=zh-CN&cd=1&ei=YlQjTJy0MYb4uQPhosjVCA&sll=35.11111,104.111111&sspn=48.954644,61.962891&brcurrent=3,0x3403f157e2e4609f:0x303e6f47a8a2281c,0,0x3403f3f633f78ad9:0x7a30a41e1da40b9e%3B5,0,0&ie=UTF8&view=map&cid=4306157070493002983&ved=0CEAQpQY&hq=%E5%B9%BF%E5%B7%9E%E9%B9%8F%E5%B3%B0%E6%9C%AC%E7%94%B0%E5%BA%97&hnear=&ll=22.531962,114.020083&spn=0.006937,0.015879&z=16&iwloc=A&output=embed""></iframe>";
Response.Write(Regex.Match(str, "(?is)sll=(?<val>.*?)&").Groups["val"]);
#7
string patern = "<style>(.*?)<style>";
string resltstr = Regex.Replace(htmlstr, patern, @"");
我也是新手
#8
只要去除style标签中的吗?还是全部HTML?
#9
少写过/
string patern = "<style>(.*?)</style>";
string resltstr = Regex.Replace(htmlstr, patern, @"");
#10
其他的我已经去掉了
就<style>标签中的去不掉
#11
static void Main(string[] args)
{
string str = @"<style>
/* Generator: eWebEditor */
p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;font-size:10.5pt;font-family:""Times New Roman"";}
div.Section1 {page:Section1;}
ol {margin-bottom:0cm;}
ul {margin-bottom:0cm;}
</style>
";
string re = "(?is)<style>.*?</style>";
str = Regex.Replace(str, re, "");
Console.WriteLine(str);
Console.ReadLine();
}
#12
string patern = "(?is)(?<=<style>)(.*?)(?=<//style>)";
string resltstr = Regex.Replace(htmlstr, patern, @"");
#13
是不是<style>标签也要去掉?是的话
string patern = "(?is)(?<=<style>)(.*?)(?=</style>)";
string resltstr = Regex.Replace(htmlstr, patern, @"");
去掉style标签之间的话
string patern = "<style>(.*?)</style>";
string resltstr = Regex.Replace(htmlstr, patern, @"");
#14
解决了,谢谢您!