I am looking for a wildcard string match API (not regex match). I cannot use anything other than Win32 APIs.
There is PathMatchSpec - but handling is specialized for files, so results might not be what you expect if you need general wildcard matching.
Otherwise, you should probably go with an RegEx, as Pavel detailed.
[edit]
I incorrectly assumed PathMatchSpec
shares the properties of FindFirstFile/FindNextFile. I've ran a few tests - it doesn't. So it looks like the best candidate.
Strange that so many years passed and nobody gave you this answer:
There is a WIN32 API that does exactly what you're looking for. (I found it searching in the MSDN for "wildcard")
It's name is SymMatchString()
. It sits in DbgHelp.dll which is part of the operating system.
Put a CriticalSection around the API call if your app is mulithreaded!
http://msdn.microsoft.com/en-us/library/windows/desktop/ms681355%28v=vs.85%29.aspx
The API that FindFirstFile()
uses internally for wildcard matches is probably FsRtlIsNameInExpression()
.
Elmü
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With