3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $matches = array(); preg_match('/^(.*)-keyword-(\d+)-([\w]+)\..+$/', 'aa-bb-cc-keyword-12345-lastword.ext', $matches); var_dump($matches);
based on poXZP
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(4) { [0]=> string(35) "aa-bb-cc-keyword-12345-lastword.ext" [1]=> string(8) "aa-bb-cc" [2]=> string(5) "12345" [3]=> string(8) "lastword" }