Je connaissais trim() mais effectivement c'est pour supprimer des espaces au début et à la fin.
L'autre solution proposée ne marche pas. Pour la recherche sur "n ous" j'ai (en rouge) :
$ta = $_POST['recherche'];
$ta = preg_replace('@([\r\n])[\s]+@','',$ta); // supprime les espaces // $ta remplace $recherche de la solution proposée
$tb = strtoupper ($recherche); // met le mot cherché en majuscules
$tc = strtolower ($recherche); // met le mot cherché en minuscules
$td = ucfirst ($recherche); // met le mot cherché avec une première lettre en majuscules
//on affiche le nombre de résultats trouvés
print '<b><p align="center"><span style="background-color:rgb(242,221,180)" font color="black" size="2" face="arial"> Pour le mot <font color="red" size="3" face="Arial">'.$ta.'<font color="black" size="2" face="arial"> il y a '.$res.' résultat(s)</b><b><font color="rgb(242,221,180)">_________</b><b><font color="#993333" size="3">http://local.free.fr</b><b><font color="rgb(242,221,180)" size="2">_________</b><b><font color="#666666">BASE DES ACTES NOTARIES DU SECTEUR HALLUIN-TOURCOING</b></span></p><font color="black"><br>';
echo $ta; // affiche n ous
echo $tb; // affiche N OUS
echo $tc; // affiche n ous
echo $td; // affiche N ous