日期:2014-05-18  浏览次数:20514 次

正则表达式-------在线等
<input   name= "submit "   type= "submit "   id= "accept_btn "   onclick= "window.location= '/cgi-bin/merchandiser?sid=PY7DeWAPWLy7EyJ8sY5Z4_9mLdwR8zFC2M1u9qdt ' "   value= "我接受 "   />

取sid=   到 ' "的数据  

正则表达式Regex   re   =   new   Regex(@ " <input[^> ]*name= " "submit " "\s*sid=(? <value> [^ '> ]*)\1[^> ]*> ");
怎么不行


------解决方案--------------------
Regex re = new Regex(@ "merchandiser\?sid=(? <sid> [^ ' " "]*) ' ");
MessageBox.Show(re.Match( " <input name=\ "submit\ " type=\ "submit\ " id=\ "accept_btn\ " onclick=\ "window.location= '/cgi-bin/merchandiser?sid=PY7DeWAPWLy7EyJ8sY5Z4_9mLdwR8zFC2M1u9qdt '\ " value=\ "我接受\ " /> ").Groups[ "sid "].ToString());