PHP& Code Snippets09 Apr 2005 04:44 pm
preg_replace - how to replace phrase inside question marks
$string = “?This is a test that should be in single quotes quotes?”;
$text = preg_replace(”/(\?([^\?]+)\?)/”,”‘\\2′”,$string);
regular expression produces:
‘This is a test that should be in single quotes’