3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $txt="Fatti&Storie 5 - Lorem ipsum dolor nid:666 [bid:667] [cid:668] [id:669] [12] sit amet [nid:112]"; $re1=".*?"; $re2="(\\[)"; $re3="((?:[a-z][a-z0-9_]*))"; $re4="(:)"; $re5='(\\d+)'; if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4.$re5."/is", $txt, $matches)) { $c1=$matches[1][0]; $var1=$matches[2][0]; $c2=$matches[3][0]; $int1=$matches[4][0]; print "($c1) ($var1) ($c2) ($int1)\n"; }
based on 6KBZC
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
([) (bid) (:) (667)