comp.lang.ada
 help / color / mirror / Atom feed
* Regular Expressions in Ada 2005?
@ 2006-11-08 20:53 matthias.kistler
  2006-11-08 21:14 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: matthias.kistler @ 2006-11-08 20:53 UTC (permalink / raw)


Hi!

Does anybody know, if it's possible to use regular expressions in Ada
2005? I come from Perl and I'm very interested in Ada but it's useless
for me without the possibility of using regular expressions similar to
Perl.
  I found a GNAT-package providing only a regex-matcher. But I also
need a replacer. Elsewise it'd be useless for me.
  Does anybody know about regular expressions in Ada 2005? Is there any
tutorial? Is there at least an Ada-library? Or can just anybody explain
to me, how to use regexes in Ada?

Thanks,
Matthias




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

* Re: Regular Expressions in Ada 2005?
  2006-11-08 20:53 Regular Expressions in Ada 2005? matthias.kistler
@ 2006-11-08 21:14 ` Georg Bauhaus
  2006-11-08 21:49 ` Pascal Obry
  2006-11-09  0:13 ` Jeffrey R. Carter
  2 siblings, 0 replies; 6+ messages in thread
From: Georg Bauhaus @ 2006-11-08 21:14 UTC (permalink / raw)


On Wed, 2006-11-08 at 12:53 -0800, matthias.kistler@gmx.de wrote:
> Hi!
> 
> Does anybody know, if it's possible to use regular expressions in Ada
> 2005? I come from Perl and I'm very interested in Ada but it's useless
> for me without the possibility of using regular expressions similar to
> Perl.

Ada comes with a rich set of string manipulation packages,
Ada.Strings.*, Ada.Characters.*, Ada.*Text_IO.Editing.

They cover a fair bit of what you would do using Perl's expressions
and translation operators in a sane way.

>   I found a GNAT-package providing only a regex-matcher. But I also
> need a replacer. Elsewise it'd be useless for me.

The GNAT packages do provide scanning and replacement. There is a
tutorial in the package specifications.

Example programs:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=regexdna&lang=gnat&id=3
http://shootout.alioth.debian.org/gp4/benchmark.php?test=regexdna&lang=gnat&id=4

#3 uses Unix style regular expressions.
#4 uses SPITBOL regular expressions.

SPITBOL patterns are quite powerful and fast, in fact you
can write an entire program just as a pattern. But don't do
that.

Georg 






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

* Re: Regular Expressions in Ada 2005?
  2006-11-08 20:53 Regular Expressions in Ada 2005? matthias.kistler
  2006-11-08 21:14 ` Georg Bauhaus
@ 2006-11-08 21:49 ` Pascal Obry
  2006-11-08 22:12   ` matthias.kistler
  2006-11-09  0:13 ` Jeffrey R. Carter
  2 siblings, 1 reply; 6+ messages in thread
From: Pascal Obry @ 2006-11-08 21:49 UTC (permalink / raw)
  To: matthias.kistler

matthias.kistler@gmx.de a �crit :
>   I found a GNAT-package providing only a regex-matcher. But I also
> need a replacer. Elsewise it'd be useless for me.

Hum, you have seen GNAT.Regexp but probably not GNAT.Regpat. The later
does support replacement. As noted by others there is also GNAT.Spitbol.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Regular Expressions in Ada 2005?
  2006-11-08 21:49 ` Pascal Obry
@ 2006-11-08 22:12   ` matthias.kistler
  0 siblings, 0 replies; 6+ messages in thread
From: matthias.kistler @ 2006-11-08 22:12 UTC (permalink / raw)


Hi!

Thank you very much to both of you! I'll try out your hints. Thanks!

Greetings,
Matthias




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

* Re: Regular Expressions in Ada 2005?
  2006-11-08 20:53 Regular Expressions in Ada 2005? matthias.kistler
  2006-11-08 21:14 ` Georg Bauhaus
  2006-11-08 21:49 ` Pascal Obry
@ 2006-11-09  0:13 ` Jeffrey R. Carter
  2006-11-09  0:14   ` Jeffrey R. Carter
  2 siblings, 1 reply; 6+ messages in thread
From: Jeffrey R. Carter @ 2006-11-09  0:13 UTC (permalink / raw)


matthias.kistler@gmx.de wrote:
> 
> Does anybody know, if it's possible to use regular expressions in Ada
> 2005? I come from Perl and I'm very interested in Ada but it's useless
> for me without the possibility of using regular expressions similar to
> Perl.

You can also look at PragmARC.Regular_Expression_Matcher (and its 
instantiation for Character and String, 
PragmARC.Character_Regular_Expression_Matcher). The demo program, 
strmsub, is a matching and replacing filter.

http://pragmada.home.mchsi.com/

-- 
Jeff Carter
"Pray that there's intelligent life somewhere up in
space, 'cause there's bugger all down here on earth."
Monty Python's Meaning of Life
61



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

* Re: Regular Expressions in Ada 2005?
  2006-11-09  0:13 ` Jeffrey R. Carter
@ 2006-11-09  0:14   ` Jeffrey R. Carter
  0 siblings, 0 replies; 6+ messages in thread
From: Jeffrey R. Carter @ 2006-11-09  0:14 UTC (permalink / raw)


Jeffrey R. Carter wrote:
> 
> The demo program, strmsub, is a matching and replacing filter.

Typo: that should be "strm_sub".

-- 
Jeff Carter
"Pray that there's intelligent life somewhere up in
space, 'cause there's bugger all down here on earth."
Monty Python's Meaning of Life
61



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

end of thread, other threads:[~2006-11-09  0:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-08 20:53 Regular Expressions in Ada 2005? matthias.kistler
2006-11-08 21:14 ` Georg Bauhaus
2006-11-08 21:49 ` Pascal Obry
2006-11-08 22:12   ` matthias.kistler
2006-11-09  0:13 ` Jeffrey R. Carter
2006-11-09  0:14   ` Jeffrey R. Carter

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