Run `wp_insert_post_data` on all posts

I ended up just writing a function inside of my template’s index.php like this.

function fancySearchAndReplace() {
    $regex = '/myregex/';
    $my_posts = get_posts(array('post_type' => 'post', 'numberposts' => -1));
    foreach ($my_posts as $post) {
        $content = $post->post_content;
        $theID = $post->ID;
        $thing = get_field('thing', $theID);
        $updatedContent = preg_replace($regex, $thing, $content);
        wp_update_post(array(
            'ID' => $theID,
            'post_content' => $updatedContent,
        ));
    }
}