3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = '1-2 дня 4-5дня 1день 8дней'; preg_match_all('/([\d+-]+)\s*д(?:ень|ня|ней)/', $string, $matches); print_r($matches[1]);

preferences:
43.26 ms | 1535 KiB | 5 Q