comp.lang.ada
 help / color / mirror / Atom feed
* regex with ada?
@ 2001-12-27 18:44 Will May
  2001-12-27 22:29 ` Mark Biggar
  0 siblings, 1 reply; 4+ messages in thread
From: Will May @ 2001-12-27 18:44 UTC (permalink / raw)


This (should) be a simple question. Is it possible to do regex commands
(e.g. s/hello/g) in ada?

What i want to do is to replace one word with another multiple times and i
know that it could be easily done with one regex expression.

Any help anyone?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regex with ada?
  2001-12-27 18:44 regex with ada? Will May
@ 2001-12-27 22:29 ` Mark Biggar
  2001-12-27 23:05   ` Eric Merritt
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Biggar @ 2001-12-27 22:29 UTC (permalink / raw)


"Will May" <will.may@btinternet.com> wrote in message news:<a0fq61$ks1$1@paris.btinternet.com>...
> This (should) be a simple question. Is it possible to do regex commands
> (e.g. s/hello/g) in ada?
> 
> What i want to do is to replace one word with another multiple times and i
> know that it could be easily done with one regex expression.

Well if you don't need wildcard support then every thing you need
for that task can be found in one of the standard packages ada.strings.fixed,
ada.strings.bounded or ada.strings.unbounded.  A combination of the routines
index and replace_slice in aloop will do what you want.

If you need wildcards then look at the two regex packages that come with Gnat,
a snobol clone and a unix regex like system.

--
Mark Biggar
mark.a.biggar@attbi.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regex with ada?
  2001-12-27 22:29 ` Mark Biggar
@ 2001-12-27 23:05   ` Eric Merritt
  2001-12-29 12:35     ` Robert Dewar
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Merritt @ 2001-12-27 23:05 UTC (permalink / raw)
  To: comp.lang.ada

> 
> Well if you don't need wildcard support then every
> thing you need
> for that task can be found in one of the standard
> packages ada.strings.fixed,
> ada.strings.bounded or ada.strings.unbounded.  A
> combination of the routines
> index and replace_slice in aloop will do what you
> want.
> 
> If you need wildcards then look at the two regex
> packages that come with Gnat,
> a snobol clone and a unix regex like system.

I am afraid I feel the overwhelming compulsion to
point out the regular expresions are quite allot more
then simply wildcards. That being said, I am glad to
know thier is a gnat extension that supports them.
There my compulsion is sated :)

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regex with ada?
  2001-12-27 23:05   ` Eric Merritt
@ 2001-12-29 12:35     ` Robert Dewar
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 2001-12-29 12:35 UTC (permalink / raw)


Eric Merritt <cyberlync@yahoo.com> wrote in message news:<mailman.1009494362.8213.comp.lang.ada@ada.eu.org>...
> > 
 
> I am afraid I feel the overwhelming compulsion to
> point out the regular expresions are quite allot more
> then simply wildcards. That being said, I am glad to
> know thier is a gnat extension that supports them.


There are actually several packages that are relevant in
GNAT (GNAT.Regexp, GNAT.Regpat, and GNAT.Spitbol.Patterns). The first
two support regular expressions Unix-style in two different flavors,
the third supports the much more powerful notion of pattern matching
and replacement found in SNOBOL-4.

Note that these are not extensions, they are simply Ada
packages supplied with GNAT. It is conceivable that they
might be adapted to work with other Ada compilers, though
likely you will have trouble with unsupported pragmas and
attributes (the GNAT packages feel quite free to use GNAT
pragmas and attributes, and in some cases, these uses are
quite fundamental, e.g. the use of Unrestricted_Access in
the GNAT.Spitbol.Patterns.

Robert Dewar



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-12-29 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-27 18:44 regex with ada? Will May
2001-12-27 22:29 ` Mark Biggar
2001-12-27 23:05   ` Eric Merritt
2001-12-29 12:35     ` Robert Dewar

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