Ec (2); I used the ereg function in the php tutorial to verify the email address, user name, and url address instance. Split the url & lt ;? $ Url & quot; www.111cn.net & quot; $ www_urlereg (& quot; ^ (www ). ([[: alnum:] + ). ([[: alnum:] +) & quot;, $ url, $ regs); if ($ script ec (2); script
We used the ereg function in the php tutorial to verify the email address, user name, and url address instance.
Split the url
$ Url = "http://www.111cn.net ";
$ Www_url = ereg ("^ (http: // www ). ([[: alnum:] + ). ([[: alnum:] +) ", $ url, $ regs );
If ($ www_url ):
Echo $ regs [0];
Print"
";
Echo $ regs [1];
Print"
";
Echo $ regs [2];
Print"
";
Echo $ regs [3];
Endif;
?>
Email Address
$ S ='m @ t. ca ';
If (ereg ('([: alpha:] +) @ ([[: alpha:] + ). ([[: alpha:] {2, 4}) ', $ s, $ matches ))
{
Echo "Regular expression successful. Dumping matchesn ";
Var_dump ($ matches );
}
Else
{
Echo "Regular expression unsuccessful. n ";
}
?>
Email address 2
$ Email = "a@a.com ";
$ Is_com = ereg ("(.) (com $)", $ email );
Print $ is_com;
?>
User name verification
$ Username = "Test ";
If (ereg ("([^ a-z])", $ username) echo "Username must be all lowercase! ";
?>