fork download
  1. <?php
  2.  
  3.  
  4. $text = 'Кaнцелярских тoваров';
  5. $regexp = '/[а-я]+([a,o,p])[а-я]+/ui';
  6. $matches = array();
  7. $result = preg_match_all($regexp, $text, $matches, PREG_SET_ORDER);
  8. var_dump($matches);
  9. //echo "{$result}";
  10.  
  11. // your code goes here
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
array(2) {
  [0]=>
  array(2) {
    [0]=>
    string(23) "Кaнцелярских"
    [1]=>
    string(1) "a"
  }
  [1]=>
  array(2) {
    [0]=>
    string(13) "тoваров"
    [1]=>
    string(1) "o"
  }
}