我想從下面的代碼中得到一個字符串flashvars
。 但是在代碼的末尾匹配的值帶有其他屬性,如pluginspage
。 我該如何解決它? 我錯了我的正則表達式?獲取flashvars的正則表達式
這裏是我的代碼:
string source = "<embed src=\"http://godtube.com/flvplayer.swf\" FlashVars=\"videoThumb=http://www.godtube.com/thumb/1_30772.jpg&flvPath=http://www.godtube.com/flvideo1/47/30772.flv\" wmode=\"transparent\" quality=\"high\" width=\"330\" height=\"270\" name=\"flv_demo\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></embed>";
Regex sRgx = new Regex("flashvars=\"(.*)\"", RegexOptions.Multiline);
Match regexMatch = sRgx.Match(source);
if (regexMatch.Success)
{
string matched = regexMatch.Groups[1].Value;
}
其工作感謝... – CodeRunner 2012-01-02 11:41:31