fork download
  1. <?php
  2.  
  3. $re = '~^(\P{Lu}*\p{Lu}.*?)\s*(\p{Lu}.*)$~us';
  4. $str = 'Иван купил мопед Рига в Москве';
  5. if (preg_match($re, $str, $match)) {
  6. echo $match[1] . "\n" . $match[2];
  7. }
Success #stdin #stdout 0.02s 23952KB
stdin
Standard input is empty
stdout
Иван купил мопед
Рига в Москве