Regex help: Match any image file beginning with an underscore
php, regex
Solution
Just remove the negation on the character set: `[^_]` becomes `_`:
if (!is_dir($file) && preg_match("/^_.*\.(bmp|jpeg|gif|png|jpg)$/i", $file))
Problem
The statement below will load all images that do not begin with an underscore character... ``` if (!is_dir($file) && preg_match("/^[^_].*\.(bmp|jpeg|gif|png|jpg)$/i", $file)) ``` I need to modify it so that it only loads images that DO BEGIN with an underscore.