日期:2014-05-19  浏览次数:20611 次

求一个正则表达式呀!
求一正则
http://222.54.214.227/ss/rf.php?site_id=15
用正则取=号后面的15
简单问题呀,算散分了。正则不会,不好意思呀!

------解决方案--------------------
try

string yourStr = ...............;
Match m = Regex.Match(yourStr, @ "http://222\.54\.214\.227/ss/rf\.php\?site_id=(? <id> \d+) ", RegexOptions.IgnoreCase);
if (m.Success)
{
MessageBox.Show(m.Groups[ "id "].Value);
}
------解决方案--------------------
Regex re = new Regex(@ "^.*site_id=(.*)$ ", RegexOptions.None);
MatchCollection mc = re.Matches( "http://222.54.214.227/ss/rf.php?site_id=15 ");
foreach (Match ma in mc)
{
MessageBox.Show(ma.Groups[1].Value);
}
------解决方案--------------------
http.*?id=([\d]*)
------解决方案--------------------
过客高手也