I suggest escaping the periods in the regex, especially if you want to guarantee a file extension.  Possibly, also anchoring the pattern with $.