I've been searching for a couple of days and I can't seem to find information on how to do this in C with fnmatch.
I'm trying to make a pattern that matches: xxxx00_xxx (x being any char, 00 being any number except 02).
So far all I've got is: ????[0-9][!2]_???
The problem, as you can see, is that it's excluding any number ending with 2 (12, 22, etc). But I'm interested in all numbers except 02.
Thanks in advance for any help you can provide.
To solve this problem with fnmatch
patterns, you need two separate patterns, for instance:
????[!0]?_???
????0[!2]_???
I chose these to avoid the possibility of any string matching both patterns, so if you're making a list of matches (e.g. using the glob
function) you should be able to just concatenate your lists.