首页 新闻 搜索 专区 学院

求解正则表达式

-1
悬赏园豆:40 [已关闭问题] 关闭于 2016-08-08 17:31

<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里面值就可以。有什么办法吗?

言言之土水的主页 言言之土水 | 初学一级 | 园豆:168
提问于:2016-08-08 15:51
< >
分享
所有回答(3)
0

什么语言?

顾晓北 | 园豆:10087 (专家六级) | 2016-08-08 15:56

C#

支持(0) 反对(0) 言言之土水 | 园豆:168 (初学一级) | 2016-08-08 15:57

@言言之土水: 一定要用正则?

支持(0) 反对(0) 顾晓北 | 园豆:10087 (专家六级) | 2016-08-08 15:58

@顾晓北: 我要做一个模拟登陆软件,这个value是post包里需要的其中一个数据,可以获得value里面值就可以。有什么办法吗?

支持(0) 反对(0) 言言之土水 | 园豆:168 (初学一级) | 2016-08-08 16:03
0
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);

}

 

Yu | 园豆:12944 (专家六级) | 2016-08-08 16:25
1

(?<=value=").*?(?=")

刘宏玺 | 园豆:14006 (专家六级) | 2016-08-08 16:33
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册