Using the posix fnmatch to compare to an empty string
Posted on 2013-01-21
I have a lot of code that uses the fnmatch C function to match strings against patterns.
From time to time I want to match against empty strings, but the wildcard * relates to one or more characters, not zero characters.
I was sure you could achieve a pattern to match all blank strings with
meaning any string that is not one character or more in length, but this does not match.
What is the "right" way to get a match from:
fnmatch(..., "", 0)
where ... is the pattern?