If the user enters a http://aaa.bbb.ccc
The code below will convert his input into a http://aaa.bbb.ccc
Let's see how powerful regular expressions are.
<%
'Call this function to display the result as a hyperjoin.
Response. Write to_html (s_message)
%>
<%
Function to_html (s_string)
To_html = Replace (s_string ,"""",""")
To_html = Replace (to_html, "<", "<")
To_html = Replace (to_html, ">", "> ")
To_html = Replace (to_html, vbcrlf, "<br> ")
To_html = Replace (to_html, "/<", "<")
To_html = Replace (to_html, "/>", "> ")
To_html = edit_hrefs (to_html)
End Function
%>
<Script language = "javascript1.2" runat = server>
Function edit_hrefs (s_html ){
// A model using regular expressions
// Convert all the superlinks and email formats in the text
S_str = new String (s_html );
S_str = s_str.replace (/bhttp: // www (. [w +.:/_] +)/gi,
"Http: // commandid scheme $1 ");
S_str = s_str.replace (/B (http: // w +. [w +.:/_] +)/gi,
"<A href =" $1 "> $1 </a> ");
S_str = s_str.replace (/B (www. [w +.:/_] +)/gi,
"<A href =" http: // $1 ">1 1 </a> ");
S_str = s_str.replace (/bhttp: // zookeeper callback (. [w +.:/_] +)/gi,
"<A href =" http: // www $1 "> http: // www $1 </a> ");
S_str = s_str.replace (/B (w + @ [w +.?] *)/Gi,
"<A href =" mailto: $1 ">1 1 </a> ");
Return s_str;
}
</Script>