<?php $text = '"The $girl$ is a $good$ person"'; echo preg_replace('/(?<!\S)\$[^$]+\$(?!\S)/', '$$0$', $text);
You have javascript disabled. You will not be able to edit any code.