Reputation: 2245
I have this HTML code:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<form action="http://www.aweber.com/scripts/addlead.pl" method="post">
<input id="email" class="text" type="text" size="20" value="Enter your best email" name="email" onblur="if (this.value == '') {this.value = 'Enter your best email';}" onfocus="if (this.value == 'Enter your best email') {this.value = '';}" />
<input type="hidden" name="meta_web_form_id" value="">
<input type="hidden" name="meta_split_id" value="">
<input type="hidden" name="listname" value="">
<input type="hidden" name="redirect" value="">
<input type="hidden" name="meta_adtracking" value="">
<input type="hidden" name="meta_message" value="1">
<input type="hidden" name="meta_required" value="email">
<input type="hidden" name="meta_tooltip" value="">
<div style="padding-top:5px;">
<center><input class="button1" id="submit" type="image" src="red_getwaitinglist.png" name="submit" value="Get Instant Access"/></center>
</div>
</form>
</BODY>
</HTML>
and I'm using this Function to replace the element using RegEx:
Function StripTags(ByVal html As String, ByVal replace As String) As String
Return Regex.Replace(html, "<form.+?</form>", replace)
End Function
but it doesn't seem to work. It returns the same code (no replacement).
I don't know much of regex so I'm assuming the RegEx syntax might be wrong. Can someone help me with that or show me where I'm wrong?
Upvotes: 0
Views: 945
Reputation: 74028
Append the RegexOption Singleline
. Without this .
will not match newlines.
Return Regex.Replace(html, "<form.+?</form>", replace, RegexOptions.Singleline)
See RegexOptions Enumeration for more details.
Upvotes: 1