Custom Tags Demo

This demo illustrates how to allow a user to specify custom tags that translate into standard HTML tags. For this demo, the following custom tags with the following translations can be used:

Custom TagTranslates To
<red>...</red><font color="red">...</font>
<highlight>...</highlight><span style="background-color: yellow;">...</span>
<important>...</important><font size="+1"><b>...</b></font>


Enter some text using the custom HTML tags...


Source Code:
	<form method="post" action="customHTMLTags.asp" id=form1 name=form1>
		<b>Enter some text using the custom HTML tags...</b><br>
		<textarea wrap="virtual" cols="50" name="HTML" rows="7">
			<%=Request.Form("HTML")%>
		</textarea>
		<p>
		<input type="submit" value="Transform HTML" id=submit1 name=submit1>
	</form>
<%
	Dim text
	text = Request.Form("HTML")
	
	if Len(text) > 0 then
		Response.Write "<p><hr><p>"
		Dim oRegExp 
		Set oRegExp = New RegExp
		
		oRegExp.Pattern = "<red>((.|\n)*?)</red>"
		text = oRegExp.Replace(text, "<font color=""red"">$1</font>")

		oRegExp.Pattern = "<highlight>((.|\n)*?)</highlight>"
		text = oRegExp.Replace(text, "<span style=""background-color: yellow;"">$1</span>")

		oRegExp.Pattern = "<important>((.|\n)*?)</important>"
		text = oRegExp.Replace(text, "<font size=""+1""><b>$1</b></font>")
		
		
		Response.Write "<b>Resulting HTML:</b><br><xmp>" & _
		           text & "</xmp><p><b>Resulting Output:</b><br>" & text
		Set oRegExp = Nothing	
	End if
%>