Regex: HTML, contents
I'm having a little issue with getting a value of field in HTML using regex.
There is a input tag in the html which is unique and here it is below.
<input type="hidden" name="t" value="I-WANT-TO-GET-THIS"/>
开发者_C百科
I would like to know, using REGEX only, how to get "I-WANT-TO-GET-THIS" (without quotes).
Thank-you very much for your time Paul
RegExp:
<input [^>]*?value="([^"]*)"
See an working example here: http://www.rubular.com/r/mG8AYSd5A1
Pattern:
<input [^>]*? value="(.*)"
How are you doing this? The best idea is to use a HTML parser. Regex with HTML has its own issues, see the link: RegEx match open tags except XHTML self-contained tags
精彩评论