fork download
  1. <?php
  2.  
  3. $re = "/^(?!__|.*thumb\\.(?:gif|jpg|png|jpeg))(?=.*\\.(?:gif|jpg|png|jpeg)$)(.*)/m";
  4. $str = "__abcd\nthumbs.jpg\nsomethumb.jpg\nthumb.jpg\nabcd.jpg\nabcd.jps\ntoto.thumb.toto.jpg";
  5.  
  6. preg_match_all($re, $str, $matches);
  7. print_r($matches[1]);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => thumbs.jpg
    [1] => abcd.jpg
    [2] => toto.thumb.toto.jpg
)