$re = '/.*(?<!_[0sml])\.jpg$/m';
$str = '9Uikt/ifehr54mg__0.jpg
9Uikt/idg4hdmg2_s.jpg
9Uikt/igdffgggfmg4_m.jpg
9Uikt/img3teg3gegg7_l.jpg
9Uikt/imgerhw45h70.jpg
9Uikt/imggq4ge37s.jpg
9Uikt/img3f37m.jpg
9Uikt/img34g3f7l.jpg
9Uikt/imgf3f34t4t73l_.jpg
9Uikt/imgf3f34t4t73l_2.jpg';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php