<div class="myClass">
<form method = "post" name="loginForm" >
<input type="text" name="userName"/>
</form>
<form method = "post" name="signupForm" >
<input type="text" name="userName"/>
</form>
</div>
if this was to be an example html.
<div>(.*?)</div>
So, something like this, anything (even nested tags) between opening and closing div tag
Perhaps help you :
(<[div]+\s[a-zA-Z]+\=\"[a-zA-Z]+\">)(.*)(<\/[div]+>)
I had to do this a few years ago, but with additional flexibility (capturing content of no matter what element):
<(?<element>\w+).*?>(?<content>.*)?</[\s]*\1>
Which works quite okay, but I have to agree with the comments above; if you can, use a fully fledged DOM parser! It'll handle edge cases etc...
Not if you really just want to get content of <div />
's that would be:
<(div).*?>(?<content>.*)?</[\s]*\1>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.