Function preg_match() for end of string matching
php, preg-match
Solution
You're using a character class when you want alternation...
"/\.(gif|png|bmp|jpe?g)$/"
Problem
I'm trying to check whether the last characters of `$url` are one of the following: `.gif` `.png` `.bmp` `.jpg` `.jpeg` It works fine for one of them: ``` if(!preg_match('/\.jpg$/', $url)) ``` but putting them all together isn't working: ``` if(!preg_match('/[\.gif$\.png$\.bmp$\.jpg$\.jpeg$]/', $url))` ``` What am I doing wrong?