3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //I want the 'delimX' to be included as well: $str = "It seems entirely 1 (b natural b) to us that there are teams of scientists in universities and other institutions around the world, attempting to 2 (b discover b) the way the world works. However, it hasn't always been that 3 (b way b) . Although the scientific method is now four or five hundred years old, the ancient Greeks, for example, believed that they could work out the 4 (b causes b) of natural events just by the power of thought."; $result = preg_split ('~([0-9 ]\(b.*?b\))~',$str ,-1, PREG_SPLIT_DELIM_CAPTURE); var_dump($result);
based on JV1sM
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
array(9) { [0]=> string(19) "It seems entirely 1" [1]=> string(14) " (b natural b)" [2]=> string(114) " to us that there are teams of scientists in universities and other institutions around the world, attempting to 2" [3]=> string(15) " (b discover b)" [4]=> string(63) " the way the world works. However, it hasn't always been that 3" [5]=> string(10) " (b way b)" [6]=> string(145) " . Although the scientific method is now four or five hundred years old, the ancient Greeks, for example, believed that they could work out the 4" [7]=> string(13) " (b causes b)" [8]=> string(48) " of natural events just by the power of thought." }