开发者

Regular expression to extract the value of hidden element

开发者 https://www.devze.com 2023-02-22 20:07 出处:网络
I have html pages with hidden element as below: < input type=hidden id=\"xl_aux2\" name=\"xl_aux2\" value=\"???\" >

I have html pages with hidden element as below:

< input type=hidden id="xl_aux2" name="xl_aux2" value="???" >

Value contains base64 string. So what will be the regular expression that I can use to extract the value开发者_JS百科 from above hidden element?


One possibility:

value="([^"]*)"

The data you want is in the first group.


There is an answer with regular expression for Base64 encoded string :

RegEx to parse or validate Base64 data

So the result expression will be like this :

/.*value=\"(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\".*/
0

精彩评论

暂无评论...
验证码 换一张
取 消