comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: GNAT.Regexp: Am I missing something?
Date: Sun, 22 Apr 2001 16:48:11 +0200
Date: 2001-04-22T16:48:11+02:00	[thread overview]
Message-ID: <3AE2EF2B.AB07037F@nbi.dk> (raw)
In-Reply-To: 3AE06CE9.E1725E0C@earthlink.net

Marc:

> So, I anticipated that by doing:
> 
>    File_Regexp := Compile("*.log", Glob => True);
> 
> I would end up with a regular expression that would match filenames
> ending in ".log".  However, that's not what's happening, none of my
> ".log" files get matched with that expression.

I would guess that the problem is that the function actually expects
"true" regular expressions. I.e. "^.*[.]log$" and not "*.log".

> I know that GNAT.Regexp can work any way its creator want, but the
> behavior doesn't jive with my expectations based on its documentation
> claiming support for "wild card patterns used in file names by the Unix
> shell".

Hmm??? That is something else than regular expressions. Have you
tried with "true" regular expressions.
 
> Am I overlooking something?  I don't want "true" regular expressions,
> I'm just using this to filter filenames based on a user-supplied
> pattern, and their expectation would obviously be to use the
> filename-matching kind of pattern.

Would it be problematic to substitute "." with "[.]", "?" with "."
and "*" with ".*"? Enclosed between "^" and "$" your file name
pattern should then be transformed to a regular expression with
the same effect.

Jacob
-- 
"Any, sufficiently advanced, technology is indistinguishable from magic."



  reply	other threads:[~2001-04-22 14:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-20 18:04 GNAT.Regexp: Am I missing something? Marc A. Criley
2001-04-22 14:48 ` Jacob Sparre Andersen [this message]
2001-04-23  5:33   ` Simon Wright
2001-04-23 21:42     ` Marius Amado Alves
2001-04-26 19:52       ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox