3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "You may organize to find or seek a neighbor or a pastor in a harbor or orchard."; echo preg_replace('~(?<!\bor) (?!or\b)~', '_', $string);

preferences:
32.11 ms | 404 KiB | 5 Q