3v4l.org

run code in 300+ PHP versions simultaneously
<?php $txt="some random shit[random shit] [nid:34]"; $re1=".*?"; $re2="(\\[)"; $re3="((?:[a-z][a-z0-9_]*))"; $re4="(:)"; if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4."/is", $txt, $matches)) { $c1=$matches[1][0]; $var1=$matches[2][0]; $c2=$matches[3][0]; print "($c1) ($var1) ($c2) \n"; }

preferences:
38.05 ms | 402 KiB | 5 Q