<input id="regUrl" type="hidden" value="https%3A%2F%2Freg.ebay.com%2Freg%2FPartialReg%3Fsiteid%3D0%26UsingSSL%3D1%26co_partnerId%3D2%26errmsg%3D%26src%3D%26signInUrl%3Dhttps%25253A%25252F%25252Fsignin.ebay.com%25253A443%25252Fws%25252FeBayISAPI.dll%25253FSignIn%252526errmsg%25253D8%252526regUrl%25253Dhttps%252525253A%252525252F%252525252Freg.ebay.com%252525252Freg%252525252FPartialReg%252525253Fsiteid%252525253D0%2525252526UsingSSL%252525253D1%2525252526co_partnerId%252525253D2%2525252526errmsg%252525253D%2525252526src%252525253D%2525252526signInUrl%252525253Dhttps%2525252525253A%2525252525252F%2525252525252Fsignin.ebay.com%2525252525253A443%2525252525252Fws%2525252525252FeBayISAPI.dll%2525252525253FSignIn%25252525252526ru%2525252525253D%2525252526rv4%252525253D1%252526pUserId%25253Dadfadfaef%252526co_partnerId%25253D2%252526siteid%25253D0%252526pageType%25253D-1%252526pa1%25253D%252526i1%25253D-1%252526UsingSSL%25253D1%252526k%25253D1%252526favoritenav%25253D%252526bshowgif%25253D0%252526gu%25253D0%252526ifh%25253D0%26rv4%3D1" name="regUrl">
我想获得其中的value值(value刷新时是会变的)不知道可以用正则匹配到吗 ?应该怎么写?
什么语言?
C#
@言言之土水: 一定要用正则?
@顾晓北: 我要做一个模拟登陆软件,这个value是post包里需要的其中一个数据,可以获得value里面值就可以。有什么办法吗?
List<string> values=new List<string>(); string pattern="<input[^>]*?id=\"regUrl\"[^>]*?value=\"([^>]*?)\"[^>]*?>"; MatchCollection mcs=Regex.Matchs(html,pattern,RegexOptions.IgnoreCase | RegexOptions.SingleLine); foreach(Match m in mcs) { values.Add(m.Groups[1].Value); }
(?<=value=").*?(?=")