Regular expressions in hell?

I am very new to Ada and I am trying to do some simple work with some text. All I want to do is read in the file and cut out everything that is not a letter, a space or a new line. therefore removing all punctuation marks and numbers. In other languages, I would simply create a simple [^ a-zA-Z] regular expression, look at each character and delete it if it matches RegEx, but I cannot find any RegEx documentation in Ada. So is there a RegEx in Ada? If not, then the best way for me to do simple text editing is like this.

Thanks a lot, -jb

+4
source share
3 answers

if you use the GNAT compiler, a set of packages has been created for this task named GNAT.RegExp , GNAT.RegPat and GNAT.Spitbol .

Beware that it is not a standard regexp ala perl, but based on SNOBOL4. however, converting from one type of regular expression to another should not be very difficult.

+10
source

You can go through this example and just look for the characters you want to ignore and not put them on a new line.

What version of Ada are you using?

http://www.adaic.com/docs/95style/html/sec_8/8-4-7.html

+1
source

I would probably look at the things of Gnoth Sable on your shoes.

However, for general lexical analysis, there is a project similar to Boot Spirit called OpenToken . For more complex tasks you may find it helpful.

I did not work with modern incarnation, but back when I was a leader, the project was an agnostic compiler.

+1
source

All Articles