in reply to matching and backreferencing filenames

...And # what about camel case extensions? This long list seems # really innefficent. (jpg|JPG|gif|GIF|wmv|WMV|mpg|MPG|avi|AVI)$/

You can do case insensitive matching with the 'i' modifier after the final matching delimiter.

(jpg|gif|wmv|mpg|avi)$/i