<?php $teststring = '"Hello" and "Goodbye."'; $greedyresult = preg_replace('/".*"/', '"***"', $teststring); $nongreedyresult = preg_replace('/".*?"/', '"***"', $teststring); echo "Original: $teststring\n"; echo "Greedy Replace: $greedyresult\n"; echo "Non-Greedy Replace: $nongreedyresult\n"; ?>