Search code examples
glob

Glob pattern help - Files NOT MATCHING a specific string


I understand the basics of PHP's glob function, but I'm having a bit of trouble with a specific type of pattern I'm trying to match. Is it possible to use glob to find files that match the following rule?

I have a list of files with the following naming convention: numbersA-numbersB-numbersC

I want to find all files where numbersA is exactly 12345 AND where numbersB IS NOT 7890. NumbersC can be anything.

Basically, I'm not trying to do a pattern match... I'm trying to do a string !=. Is this possible?

Thank you.


Solution

  • This is too much for glob. Use that for the general set, then use regexes or some other technique to filter them more finely.