<!--
Frog Frog recommended: Search for e-mail with regular expressions
Ask a question: Given a string, find out 5 emails, highlight the email in red (or other ways to highlight it),
and save the 5 messages as a comma-separated string and print them out.
-->
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "Frog Frog Prince" >
<meta name= "Keywords" content= "Frog Frog Pond" >
<meta name= "Description" content= "quack" >
<script language= "JScript" >
function Wawa_matchmail (str)
{
/*
*---------------Wawa_matchmail (str)-----------------
* Wawa_matchmail (STR)
* Function: Search for a substring within a string that matches the message format, return a new string, and include 5 messages that are searched and separated by commas.
* Parameter: str, string type, the main string to search for.
* Example: Wawa_matchmail ("only@sohu.com,ddd,only163.com")
* Author: Pole Prince Frog Frog
* Update:2004-7-28 13:07
*---------------Wawa_matchmail (str)-----------------
*/
I'm here with the string object's match method.
var re=/w+ (-w+) | (. w+)) *@[a-za-z0-9]+ ((. | -) [a-za-z0-9]+] *. [A-za-z0-9]+/g;
var m=mainstring.match (re);
var m1= ""
for (Var i=0;i<m.length&&i<5;i++) {
M1+=m[i].fontcolor ("blue") + ",";
}
Return (M1);
}
function Wawa_replacemail (str)
{
/*
*---------------Wawa_replacemail (str)-----------------
* Wawa_replacemail (STR)
* Function: Search for a substring within a string that matches the message format, generate a new string, and use red to represent the message part.
* Parameter: str, string type, the main string to search for.
* Example: Wawa_replacemail ("only@sohu.com,ddd,only163.com")
* Author: Pole Prince Frog Frog
* Update:2004-7-28 13:07
*---------------Wawa_replacemail (str)-----------------
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.