pattern matching in .Net consistent with IsolatedStorageFile.GetFileNames() pattern matching
Posted
by
Mick N
on Stack Overflow
See other posts from Stack Overflow
or by Mick N
Published on 2010-12-26T05:40:39Z
Indexed on
2010/12/26
5:54 UTC
Read the original article
Hit count: 393
Is the pattern matching logic used by this API exposed for reuse somewhere in the .Net Framework?
Something of the form FilePatternMatch( string searchPattern, stringfileNameToTest ) is what I'm looking for.
I'm implementing a temporary workaround for WP7 not filtering the results for this overload and I'd like the solution to both provide a consistent experience and avoid reinventing this functionality if it is exposed.
If the behaviour is not exposed for reuse, a regular expression solution (like glob pattern matching in .NET) will suffice and would save me spending the time to test the fine details of what the behaviour should be.
Perhaps one of the answers posted in the thread linked above is correct. Since I haven't confirmed the exact behaviour as yet, I wasn't able to determine this at a glance. Feel free to point me to one of those answers if you know it is behaviouraly an exact match to the API referenced in the question title.
I could assume the pattern matching is consistent with how DOS handled * and ? in 8.3 file names (I'm familiar with behavioural nuances of that implementation), but it's reasonable to assume Microsoft has evolved pattern matching behaviour for file names in the decade+ since so I thought I would check before proceeding on that assumption.
© Stack Overflow or respective owner