From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8b688ddbf65a9e2e,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-20 11:04:43 PST Path: supernews.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3AE06CE9.E1725E0C@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: GNAT.Regexp: Am I missing something? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 20 Apr 2001 18:04:43 GMT NNTP-Posting-Host: 158.252.123.240 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 987789883 158.252.123.240 (Fri, 20 Apr 2001 11:04:43 PDT) NNTP-Posting-Date: Fri, 20 Apr 2001 11:04:43 PDT X-Received-Date: Fri, 20 Apr 2001 11:03:21 PDT (newsmaster1.prod.itd.earthlink.net) Xref: supernews.google.com comp.lang.ada:7049 Date: 2001-04-20T18:04:43+00:00 List-Id: I wanted to use GNAT.Regexp to assist with some filename filtering on Linux, and seeing the following documentation in the package spec made me optimistic: -- A second kind of regular expressions is provided. This one is more -- like the wild card patterns used in file names by the Unix shell (or -- DOS prompt) command lines. The grammar is the following: Then the function that compiles the regular expression string says: function Compile (Pattern : String; Glob : Boolean := False; Case_Sensitive : Boolean := True) return Regexp; -- Compiles a regular expression S. If the syntax of the given -- expression is invalid (does not match above grammar, Error_In_Regexp -- is raised. If Glob is True, the pattern is considered as a 'globbing -- pattern', that is a pattern as given by the second grammar above 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. If I use a regular expression that leads with a character, like "l*", that will match all filenames starting with 'l', but of course that's not what I want. The behavior I'm seeing with the "Glob" mode is more like DOS wildcard file matching rather than Unix. 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". 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. Thanks for any assistance, Marc