Preg-replace Function - Word Boundry and Case Insensitive

How do I add case insensitive feature to the preg_replace function. I read that it is “/i” but exactly where do I add it?



$main[] = "/\\b".$row['main']."\\b/"; 
$linkedarticle = preg_replace($main, $keyword, $article, 1);



$main[] = "/\\b".$row['main']."\\b/i";

:slight_smile:

See also: http://php.net/regexp.reference.delimiters (:

Additionally, [fphp]preg_quote[/fphp] may come in handy as you’re dynamically building your pattern.

Haha perfect, thanks!