From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a37:5242:: with SMTP id g63mr39059544qkb.317.1609057211936; Sun, 27 Dec 2020 00:20:11 -0800 (PST) X-Received: by 2002:ad4:5445:: with SMTP id h5mr42183263qvt.22.1609057211818; Sun, 27 Dec 2020 00:20:11 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 27 Dec 2020 00:20:11 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR NNTP-Posting-Host: 84.209.88.37 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Easiest way to use redular expressions? From: reinert Injection-Date: Sun, 27 Dec 2020 08:20:11 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:60945 List-Id: Hello, I made the following hack to match a string with a regular expression (using a named pipe and grep under linux): procedure to_os (str : String) is package c renames Interfaces.C; procedure system_rk (source : in c.char_array); pragma Import (c, system_rk, "system"); begin system_rk (Interfaces.C.To_C (str)); end to_os; function match1(S,P : String) return boolean is cfile1 : constant String := "regexp_pipe0"; file1 : File_Type; str1 : constant String := "echo " & S & "| grep -ic " & P; begin to_os(str1 & " > regexp_pipe0 &" ); Open(file1,In_File,cfile1); return b : constant boolean := Natural'Value(get_line(file1)) > 0 do Close(file1); end return; end match1; ----------------------------------------- OK, I assume it somehow breaks the philosophy on Ada and security/reliability. Could someone therefore show a better and more simple way to do this? gnat.expect? reinert