<! --
Frog frog recommendation: use regular expressions to search for emails
Ask the question: Give a string, find 5 emails, and highlight the emails in red (or other display modes ),
The five emails are saved as a string separated by commas and printed 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 prince">
<Meta name = "Keywords" CONTENT = "frog pond">
<Meta name = "Description" CONTENT = "">
<Script language = "JScript">
Function wawa_matchmail (str)
{
/*
* --------------- Wawa_matchmail (str )-----------------
* Wawa_matchmail (str)
* Function: search for a substring that matches the mail format in a string, and return a new string that contains five searched mails separated by commas.
* Parameter: str, string type, master string to be searched.
* Instance: wawa_matchmail ("only@sohu.com, ddd, only163.com ")
* Author: Tianji, frog prince
* Update:
* --------------- Wawa_matchmail (str )-----------------
*/
// Here I use the match method of the string object.
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 that matches the mail format in a string, generate a new string, and use red to represent the part of the email.
* Parameter: str, string type, master string to be searched.
* Instance: wawa_replacemail ("only@sohu.com, ddd, only163.com ")
* Author: Tianji, frog prince
* Update:
* --------------- Wawa_replacemail (str )-----------------