首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

如何获取首尾固定的字符串

2012-09-08 
怎么获取首尾固定的字符串在一段文本里出现/plus/download.php?open2&id114&uhash67aed3395bb5d02c3eb3

怎么获取首尾固定的字符串
在一段文本里出现/plus/download.php?open=2&id=114&uhash=67aed3395bb5d02c3eb3980e"
这一段字符串 开头/plus/download.php?open这段和最后一个引号是固定的 剩下的都是不固定的
我怎么才能取到以/plus/download.php?open开头以"结尾的字符串

[解决办法]
注意?要转义

C# code
string pattern1 = @"(?i)/plus/download.php\?open[^""\s]+?""";
[解决办法]
Htmlstr.Text = strRegex;
应该是
Htmlstr.Text = m[0].Value;
或者类似的……
[解决办法]
string str = "/plus/download.php?open=2&id=114&uhash=67aed3395bb5d02c3eb3980e\"";
var s = Regex.Match(str, @"(?is)/plus/download\.php\?open[^""]+(?="")").Value;
Response.Write(s);
***********************
结果
/plus/download.php?open=2&id=114&uhash=67aed3395bb5d02c3eb3980e 
***********************

热点排行