Wildcard pattern matching

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have noticed that in the directoryInfo class a method named GetFiles(String) accepts a wildcard pattern as a parameter and uses this to match file names that exist in a directory. I want to use the pattern matching agorithm it uses. Why is it not exposed to public access?

Thank you.
 
I have noticed that in the directoryInfo class a method named
GetFiles(String) accepts a wildcard
pattern as a parameter and uses this to match file names that exist in a directory. I want to use the
pattern matching agorithm it uses. Why is it not exposed to public
access?

It isn't exposed because the algorithm lies in the file system.
However the best way to go will be certainly regular expressions.
 
Iam not RegEx expert but I think you can simply replace * and ? with the
corresponding RexEx joker characters/sequences. Be sure that you escape
reserved regex characters/sequences in your string before passing it to a
regex method.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
RobC said:
Thank you Cody! BTW, mimicking file search wildcard patterns with regex
is no easy task. Is this already written somewhere?
Thanks.

cody said:
I have noticed that in the directoryInfo class a method named
GetFiles(String) accepts a wildcard
pattern as a parameter and uses this to match file names that exist in
a
directory. I want to use the
pattern matching agorithm it uses. Why is it not exposed to public
access?

It isn't exposed because the algorithm lies in the file system.
However the best way to go will be certainly regular expressions.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
 
Back
Top