How Do I Change Text Permanently In A Post/Page Programmically?

I can change text dynamically with:

add_filter(‘the_content’, ‘rewriteText’:wink:;

function rewriteText($text) {

$input = str_replace(‘Look For Text’, ‘Change To Text’, $text);

return $text;


but how do I do it permanently? I need to be able to do it on Posts and Pages if there is a difference.