On Wed, 2011-05-04 at 13:20 -0600, Jason Gerfen wrote: > I am running into a problem using the REGEXP option with filter_var(). > > The string I am using: 09VolunteerApplication.doc > The PCRE regex I am using: > /^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di > > The function in it's entirety: > return (!filter_var('09VolunteerApplication.doc', > FILTER_VALIDATE_REGEXP, > array('options'=>array('regexp'=>'/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di')))) > ? false : true; > > Anyone have any insight into this? > You missed a + in your regex, at the moment you're only checking to see if a file starts with a single a-z or number and then is followed by the period. Then you're checking for oddly for one to four extensions in the list, are you sure you want to do that? And the square brackets are used to match characters, not strings, use the standard brackets to allow from a choice of strings Try this: '/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls)$/Di' One other thing you should be aware of maybe, filenames won't always consist of just the letters a-z and numbers 0-9, they may contain accented or foreign letters, hyphens, spaces and a number of other characters depending on the client machines OS. Windows allows very few characters for example compared to the Unix-like OS's like MacOS and Linux. -- Thanks, Ash http://www.ashleysheridan.co.uk