3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'Hello How are you :slight_smile::joy:'; $regex = "/:([a-zA-Z0-9_]*):/"; preg_match_all($regex, $string, $matches); print_r($matches[0]);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Array ( [0] => :slight_smile: [1] => :joy: )

preferences:
96.01 ms | 402 KiB | 62 Q