fork download
  1. <?php
  2.  
  3. $re = '/(\d+)\s*([\p{Pd}xх]|na|на)\s*(\d+)/u';
  4. $str = '100 на 60, 100 руб';
  5. preg_match_all($re, $str, $matches, PREG_SET_ORDER);
  6. foreach ($matches as $m) {
  7. echo $m[1] . ", " . $m[2] . ", " . $m[3] . "\n";
  8. }
  9.  
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
100, на, 60