in reply to help with []'s in regex please
return if ! ( /\.[jJ][pP][eE]?[gG]$/ );
The brackets mean "one of these characters" while the question mark means "the preceeding element is optional" or "0 or 1 of the preceeding element", depending on how you want to look at it.
Of course, I'd switch out the "if !" for "unless"... but there be another religious war ;-)
(PS - unless performance matters, just use the i modifier - /\.jpe?g/i is just about as fast as the above.)
|
|---|