3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = "abdsasdbm absdas dbasdn mda 2-01602171-63543"; $regex = "/[0-9]{1}-[0-9]{8}-[0-9]{5}/"; $result = (preg_match($regex, $string, $result)) ? $result : ""; var_dump($result);
based on cK2rM
Output for 5.3.22 - 7.2.6
array(1) { [0]=> string(16) "2-01602171-63543" }