fork download
  1. <?php
  2.  
  3. $re = '~\b\p{L}(?:\h+\p{L}){2,}\b(?![\s\p{P}]*$)~u';
  4. $str = "Lorem i p s u m dolor sit a m e t, consectetur adipiscing e l i.";
  5. preg_match_all($re, $str, $matches);
  6. print_r($matches[0]);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => i p s u m
    [1] => a m e t
)