<?php $needle = ':Name'; $str = ":Name :Name_en"; echo "Leading word boundary\t\t" . preg_replace("#\b$needle\b#", '"Test"', $str); echo "\n---\n"; echo "No leading word boundary\t" . preg_replace("#$needle\b#", '"Test"', $str); echo "\n---\n"; echo "Leading non-word boundary\t" . preg_replace("#\B$needle\b#", '"Test"', $str);
You have javascript disabled. You will not be able to edit any code.