<?php
$text = '"¡Á É Ñ Elaskar me mandaba flores pero yo creía que eran de Fariña!", dijo Dominique Pestaña';
function parseStopWords($text){
$text = preg_replace('/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ¡\', ]/i','',$text);
$stopwords = array('a','ante','bajo','cabe','con','contra','de','desde','en','entre','hacia','hasta','para','por','sin','sobre','tras','el','lo','la','los','las','un','unos','una','al','del','que','es','se','y','fue');
foreach($stopwords as $w){
$text = preg_replace('/\b'.$w.'\b/i','',$text);
}
$text = preg_replace('/\s{2,}/i',' ',$text);
return $text;
}
echo parseStopWords($text);
die;
echo preg_replace('/[\x{00ff}-\x{ffff}]/u', '*', $text);
echo $text;
$mystring = 'Título ú Nota ó !¡ ! áéíóúñ )()&*%#$DR GT^(%(%(*&_{|}{jjkg cde d"';
$find = array ( '#[^a-z0-99áéíóúñ\\s]#is', '#\\s#' );
$replace = array ( '', ' ' );
$mystring = preg_replace ( $find, $replace, $mystring );
echo $mystring;
preferences:
41.21 ms | 406 KiB | 6 Q