Hi Bruno, > 'is_fnmatch_pattern' is probably a misnomer, because its argument is > by definition already an fnmatch pattern. What the function is testing is > whether it contains wildcard characters
Yes, indeed. > Btw, this function does not handle multiple adjacent backslashes correctly, > i.e. patterns such as 'ab\\[cd]'. > > Also, I'm surprised that this function does not take an 'options' argument. > For example, the string 'ab\[cd\]' is constant if FNM_NOESCAPE is off, but > non-constant if FNM_NOESCAPE is on. Good catch. I'll fix this. > I would like to see some unit tests committed to this module before the > big optimization. OK, I'll write some. > Thinking more into the future, there are now multiple optimizations of > regex / fnmatch from various sides. (Recall that fnmatch patterns can > be transformed into regular expressions.) By the way, I am also experimenting with the idea of re-implementing the exclude module using DFA, i.e. regarding the entire exclude list as a set of regular language definitions and creating a DFA for each of them (it is a *set* of definitions, because its parts can have different EXCLUDE_* flags, so they should be processed differently). This may constitute a significant speed-up. Regards, Sergey