[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]Pattern Matching in System.IO.Directory
From: |
Gopal V |
Subject: |
Re: [DotGNU]Pattern Matching in System.IO.Directory |
Date: |
Sat, 2 Nov 2002 15:26:18 +0530 |
User-agent: |
Mutt/1.2.5i |
If memory serves me right, Charles Shuller wrote:
> for how pattern should work, but the spec implies, when it states path
> seperators are not allowed, that the Pattern is a generic 'GLOB' thing.
> For instance, foo.* or *.bar or ?oo.bar.
Yup , it looks that way for sure ...
> I would much rather implement a full blown regexp implementation, using
> libc's backing regexp library. I think it will be far more usefull to
> anyone actually using it, plus, it will still behave as expected for the
> simpler version outlined above.
[MethodImpl(MethodImplOptions.InternalCall)]
internal static bool InternalRegexpMatch(String input, String pattern);
and call it via a helper method which can check for errors in pattern.
> Just not throw an exception if a path seperator is included
> (as a path seperator in Windows could be an escape character for regexp)
Well, always use Path.DirectorySeperatorChar and the other fields there.
That would allow us to throw a correct exception in windows, and allow
for escape chars in unix as.
> Does anyone have any problems with this? Do we need to supply a
> strictly conformant mode somehow? (I'm thinking no on the later, as
> strictly conforming applications will still behave as expected).
A "strictly conformat" mode would not too much extra work. IMHO a
more flexible model is always preferred ... for example throw an
exception on '[' or replace '.' with '\.' to produce an illusion of
conformance, or add '^' ,'$' at either end for a perfect match only.
and '*' => ".*" .... (ad infinitum).
Btw, do send in the patch before it grows huge .. :-)
HTH,
Gopal
--
The difference between insanity and genius is measured by success