3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $s = "Stackoverflow is awesome"; $regex = '~(?=(\S+\s+\S+))|\S+(?=\s+\S+|$)~'; preg_match_all($regex, $s, $matches); print_r($matches);
Output for 4.3.0 - 7.2.0
Array ( [0] => Array ( [0] => [1] => Stackoverflow [2] => [3] => is [4] => awesome ) [1] => Array ( [0] => Stackoverflow is [1] => [2] => is awesome [3] => [4] => ) )