0

I am trying to replace the keyword with another keyword, but not want to replace the keyword if it starts with = (equal) sign.

For example:

$content = "This is my bag and but is =bag".
$replace = 'testing';
$find = "bag".

$ptn = '/\b' . preg_quote($find, '\b/') . '\b/';

preg_replace($ptn, $replacement, $content, $limit =2, $count=2);

But this returning: This is my testing and but is =testing

I want: This is my Testing and but is =bag

Please help me to write the correct pattern.

Thanks

D Singh
  • 283
  • 3
  • 13

0 Answers0