This question has already been answered:

Good day! Why is this expression -

preg_match_all('/\S{2,}/s', $text, $out); 

Does it work correctly with English characters and incorrectly with Russians (it works on one letter)?

Reported as a duplicate by the participants αλεχολυτ , Mikhail Vaysman , Denis Bubnov , vp_arth , Sasha Omelchenko 26 Apr '17 at 5:17 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • four
    Most likely, because $ text in unicode. Add a u modifier. - Indifferent
  • For sure. Thank. - woland

1 answer 1

Most likely, because $text in unicode. Add u modifier:

 preg_match_all('/\S{2,}/us', $text, $out); 

Reply moved from comment