<?php $text = 'The $girl$ is a $good$ person, and keep $$this$$.'; echo preg_replace('/\${2,}[^\s$]+\${2,}(*SKIP)(*FAIL)|\$[^\s$]+\$/', '\$$0\$', $text);
You have javascript disabled. You will not be able to edit any code.