It is necessary to find all the files with any extension, why, if there are more than two words in the title, are you not looking? Folders do not need

$str = 'Новый текстовый документ.txt'; echo preg_match('#[a-z0-9A-ZА-Яа-я\s]+\.[az]+#', $str); 
  • I'm not going to list all the extensions - DivMan
  • .............. *.* ? - Alexey Shimansky
  • $temp_files = glob(__dir__.'/*'); foreach($temp_files as $file) {.............} $temp_files = glob(__dir__.'/*'); foreach($temp_files as $file) {.............} - Alexey Shimansky
  • I don't need folders - DivMan

1 answer 1

Why, if there are more than two words in the title, are you not looking?

Because you need to use the global search preg_match_all ()

 $str = 'Новый текстовый документ.txt'; preg_match_all('#[a-zа-яё0-9\s]+\.[az]+$#iu', $str, $arr); var_dump($arr);