源文件是這樣的:
<div class="rich_media_thumb_wrp" id="media">
<script>
(function () {
var cover = "http://mmbiz.qpic.cn/mmbiz/BUu3PFe5Z4t9ibibqkUL2rWOicRgckVubeL4Coyaa1g5UZuvEibpvQCVVlic13NYDWzRUpHibibJZZ7iaL78wT9refF9bg/0?wx_fmt=jpeg";
document.write('<img class="rich_media_thumb" id="js_cover" onerror="this.parentNode.removeChild(this)" data-backsrc=' + cover + ' data-src="' + cover + '" />');
})();
</script>
</div>
請問,我想取得cover的值,用C#正則怎麼查找到?
這個cover的值為:http://mmbiz.qpic.cn/mmbiz/BUu3PFe5Z4t9ibibqkUL2rWOicRgckVubeL4Coyaa1g5UZuvEibpvQCVVlic13NYDWzRUpHibibJZZ7iaL78wT9refF9bg/0?wx_fmt=jpeg
Match m= Regex.Match("你的那串字符", " var cover = \"([^\"]+)\"");
Response.Write(m.Groups[1].Value);