Wildcard pattern matching

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.
 
C

cody

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.
 
C

cody

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top