If the user enters the HTTP://AAA.BBB.CCC
The following code converts his input into a HTTP://AAA.BBB.CCC
We look at the regular expression of how powerful, hehe.
<%
' Call this function to display as a super join
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) {
An example of using regular expressions
Convert all hyperlinks and e-mail formats in text
S_str = new String (s_html);
S_str = S_str.replace (/http://www (. [ w+.:/ _]+)/gi,
"Http://¬¤¸$1");
S_STR = S_str.replace (/(http://w+.[ w+.:/ _]+)/gi,
"<a href=" (">$1</a>");
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.