comp.lang.ada
 help / color / mirror / Atom feed
From: "Terry J. Westley" <twestley@buffalo.veridian.com>
Subject: Re: Regular Expressions & Ada 95
Date: 1999/02/08
Date: 1999-02-08T00:00:00+00:00	[thread overview]
Message-ID: <918499449.4808@outpost1.roc.accglobal.net> (raw)
In-Reply-To: 36BE36C1.11773AB0@dsuper.net

TASH is an Ada 95 binding to Tcl/Tk.  Among other things, you'll
get regular expression pattern matching.

Here's an excerpt from the (hopefully) soon to be released new and
improved thick binding.  This excerpt and the example provide regular
expression pattern matching to find patterns in elements of Tash lists.
There will also be the capability to perform regular expression matches
directly on strings as well.  I just happening to be finishing up the
list regexp match right now.

--------------------------------------------------------
-- Use regular expressions to search a list. Index returns
-- the index (in the range 1..Length(Source)) in Source
-- of the element which matches the specified regular
-- expression. Returns 0 if the pattern is not found.
--------------------------------------------------------
function Index (Source : in Tash_List;
                Regexp : in String;
                Going  : in Ada.Strings.Direction := Ada.Strings.Forward)
   return Natural;

Here's an example:

declare
   use type Tash.Lists.Tash_List;
   Target_String : Tash.Lists.Tash_List := Tash.Lists.To_Tash_List (
      +"this Tash string is an element of a Tash list",
     +"here's a second element");
begin
   if Tash.Lists.Index (Target_String, "[tT][aA][sS][hH]") > 0 then
      Ada.Text_IO.Put_Line ("Tash found");
   end if;
 end;

--
Terry J. Westley, Principal Engineer
Veridian Engineering, Calspan Operations
twestley@buffalo.veridian.com   http://www.veridian.com/
-------------------------------------------------------
Author of TASH, an Ada binding to Tcl/Tk.
Visit the TASH web site at http://tash.calspan.com.
-------------------------------------------------------








      parent reply	other threads:[~1999-02-08  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-07  0:00 Regular Expressions & Ada 95 Yannick Manningham
1999-02-08  0:00 ` bill
1999-02-09  0:00   ` robert_dewar
1999-02-10  0:00   ` Ehud Lamm
1999-02-08  0:00 ` Terry J. Westley [this message]
replies disabled

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