/ / In this example, preg_quote( $word) is used to keep the / / asterisks from having special meaning to the regular / / expression. $textbody = "This book is *very* difficult to find ."; $word = "*very*"; $textbody = preg_replace (" / ".preg_quote($word) ." / "," i ".$word. "/ i", $textbody);
?php / / Dans cet exemple, preg_quote( $word) sert à éviter que les astérisques / / prennent une valeur particulière dans l'exepression régulière. $textbody = "Ce livre est *très* difficile à trouver ."; $word = "*très*"; $textbody = preg_replace (" / ".preg_quote($word) ." / "," B ".$word. "/ B", $textbody);?