3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "This is a (first) test with the first hit", "This is a (first] test with the first hit" ]; foreach ($strings as $str) { preg_match( '/(?:\(first\)|\[first]|{first})(*SKIP)(*FAIL)|\bfirst\b/', $str, $matches, PREG_OFFSET_CAPTURE); print_r($matches); }

preferences:
29.64 ms | 405 KiB | 5 Q