I am getting an whole html page from an ajax request as text (xmlhttp.responseText)
Then filtering the text to extract a html form from that text and everything inside that form.
I wrote an regex :
text.match(/(<form[\W\w]*<\/form>)/gim)
As i am not an expert in regex, so i cant be sure will it work in every scenario and get everything inside the form tag?
Is there a better way that i can say everything in regex? so that the regex will look like
text.match(/(<form[__everything_syntaxt_here__]*<\/form>)/gim)

formtag stuff, or from<form..> to </form>or both ?<form> ......</form>tag and also the beginning and end tag too.@slnresponseXMLor make adocumentFragmentor hidden<div>and approach the response as what it is, a HTML page with a DOM tree. So then you simply getparsedDom.getElementsByTagName('form')[0]and do what you want with it.