From: reinert <reinkor@gmail.com>
Subject: Easiest way to use redular expressions?
Date: Sun, 27 Dec 2020 00:20:11 -0800 (PST) [thread overview]
Message-ID: <c61b760c-7f56-4e22-9b40-b863a5544764n@googlegroups.com> (raw)
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
next reply other threads:[~2020-12-27 8:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-27 8:20 reinert [this message]
2020-12-27 8:36 ` Easiest way to use redular expressions? J-P. Rosen
2020-12-27 11:14 ` Emmanuel Briot
2020-12-27 20:31 ` oliverm...@gmail.com
2020-12-28 8:01 ` Per Sandberg
2020-12-28 13:58 ` Maxim Reznik
2020-12-28 21:07 ` Jeffrey R. Carter
2020-12-31 10:29 ` reinert
2021-01-05 1:31 ` Shark8
2021-01-05 9:27 ` Dmitry A. Kazakov
2021-01-05 10:46 ` Paul Rubin
2021-01-05 11:20 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox