3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'Me, my dog and “myself“ are going on a vacation. Irene and myself are broke. Myself is here :P John and myself!'; if (preg_match_all('/(?:\S+\s+){0,2}\p{P}?myself\p{P}?(?:\s+\S+){0,2}/u', $text, $result)) { print_r($result[0]); }

preferences:
30.75 ms | 405 KiB | 5 Q