after some
'Searching On This Forum' (note for future reference!!)
i've found your answer, i should really know some basics about preg_replace by now, but never mind, heres what your looking for
<?
$string = "Hello 'user' and 'user2'!";
$string = preg_replace("/'([a-zA-Z0-9_]+)'/e", "_$1_", $string);
echo $string; // outputs 'Hello _user_ and _user2_!'
?>
hth