3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_numerics ($str) { preg_match( '/(?<=\bLevel\s)(?:[\w-]+)/is', $str, $matches); return $matches; } $one = 'aasdjhgasd asgdahjsd hjg 4ht ahsjdhkajsdhakjsdh Level 1, 100 XP Unlocked 3 Jul'; $string = "This is a string, keyword next, some more text. keyword next-word. keyword another_word. Okay, keyword do-rae-mi-fa_so_la."; print_r(get_numerics($one)); print_r(get_numerics($string));

preferences:
43.68 ms | 402 KiB | 5 Q