<? Php
Function validateEmail ($ email)
{Return eregi ("^ [_ a-z0-9-] + (\. [_ a-z0-9-] +) * @ [a-z0-9-] + (\. [a-z0-9-] + )*(\. [a-z] {2, 3}) $ ", $ email );
}
Function validateURL ($ url)
{Return eregi ("^ (ht | f) tp: //) ([a-z0-9-] + (\. [a-z0-9-] + )*(\. [a-z] {2, 3}) | ([0-9] {1, 3 }\.) {3} ([0-9] {1, 3}) (/| \?) A-z0-9 ~ # % & '_ \+ = :\? \.-] *) $ ", $ Url );
}
Function convertURLS ($ text)
{$ Text = eregi_replace ("(ht | f) tp: // www \. | www \.) ([a-z0-9-] + (\. [a-z0-9-] + )*(\. [a-z] {2, 3}) (/| \?) A-z0-9 ~ # % & \\/'_ \+ = :\? \.-] *) "," Http: // www. \ 3 ", $ text );
$ Text = eregi_replace ("(ht | f) tp: //) ([a-z0-9-] + (\. [a-z0-9-] + )*(\. [a-z] {2, 3}) | ([0-9] {1, 3 }\.) {3} ([0-9] {1, 3}) (/| \?) A-z0-9 ~ # % & '_ \+ = :\? \.-] *) "," <A href = \ "\ 0 \"> \ 0 </a> ", $ text );
Return $ text;
}
Function convertMail ($ text)
{$ Text = eregi_replace ("([_ a-z0-9-] + (\. [_ a-z0-9-] +) * @ [a-z0-9-] + (\. [a-z0-9-] + )*(\. [a-z] {2, 3}) "," <a href = 'mailto: \ 0'> \ 0 </a> ", $ text );
Return $ text;
}
Function convertAllLinks ($ text)
{$ Text = convertURLS ($ text );
$ Text = convertMail ($ text );
Return $ text;
}
?>