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', $matches); var_dump($matches);
based on aTXDq
Output for 4.3.0 - 7.1.0
array(4) { [0]=> string(31) "aa-bb-cc-keyword-12345-lastword" [1]=> string(8) "aa-bb-cc" [2]=> string(5) "12345" [3]=> string(8) "lastword" }