function htmlizeEmails($text){
preg_match_all('/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})/',$text,$potentialEmails,PREG_SET_ORDER);
$potentialEmailsCount=count($potentialEmails);
for($i=0;$i<$potentialEmailsCount;$i++){
if(filter_var($potentialEmails[$i][0],FILTER_VALIDATE_EMAIL)){
$text=str_replace($potentialEmails[$i][0],'<a href="mailto:'.$potentialEmails[$i][0].'">'.$potentialEmails[$i][0].'</a>',$text);
}
}
}
Использование:
http://stackoverflow.com/questions/9763606/detecting-emails-in-a-text
Необходимо настроить 301-й редирект со всех страниц сайта с символами верхнего регистра в URL на аналогичные страницы с нижним регистром.
При этом редирект не должен затрагивать GET параметры после знака «?» в URL.
$url_get=urldecode($_SERVER['REQUEST_URI']);
if(strpos($url_get,'?')!==false){
$a=explode("?",$url_get);
$a[0]=mb_strtolower($a[0]);
$newurl=$a[0]."?".$a[1];
}
else{
$newurl=mb_strtolower($url_get);
}
if(urldecode($_SERVER['REQUEST_URI'])!=$newurl){
header('Location: '.$newurl,true,301);
}
Например разделить строку по латинской X и русской Х.
$exp=preg_split("/(x|х)/",$str);
$text=preg_replace('/style=\\"[^\\"]*\\"/','',$text);
http://community.sitepoint.com/t/remove-inline-style-with-preg-replace/21743/2