Since str_replace() matches \":Name\" two times in \":Name :Name_en\" I want to match the results for the whole word only. I wanted to switch to preg_repl
str_replace()
preg_repl
You don't need the word boundary on the start of your string:
$str = preg_replace('/:Name\b/i', '"Test"', $str);