I'm trying to write such a regular expression that shows me all filenames, except the ones with extension: pdf, xls, doc. Any idea how this regexp should look like? I recognize I am no good in writing regexp, I tried to do something like this:
'[a-zA-Z0-9\.\s_]*([^(pdf)])$'
but it shows me all files that do not end with f...
The input to the regexp is a filename or a directory. This expression is evaluated inside a piece of software, using reg function of php, and if the filename matches this pattern that it does not gets displayed. As I want to hide all files that do not have "doc", "pdf" and "jpg" extension, my expression should match all files that have these extensions... and no other files. It should still match all directory names, though.
Is this something doable in this form, or should I try to rewrite the validation engine?
Your regex tries to be a subpattern in a character class, but a character class is always a character class no matter what. And actually, in the regex that you're after, you don't need any complicated lookaheads or lookbehinds because you know exactly which types you'll accept.