[Tutor] Simple text transform with an RE

dman dsh8290@rit.edu
Mon, 20 Aug 2001 11:40:35 -0400

On Mon, Aug 20, 2001 at 10:42:25AM -0400, Ignacio Vazquez-Abrams wrote:
| On Mon, 20 Aug 2001, Schmidt, Allen J. wrote:
| > Hello all...
| >
| > I need to learn more about regular expressions. A quick answer to this
| > should help...
| >
| > I have a text file of database field names - about 90 of them - one on a
| > line ended with a line break.
| > I need to build something with an RE to read each field from the file, then
| > add parts to each field like "ALTER TABLE ADD ....field_name " at the
| > beginning and other things to the end of the field name. So, I am trying to
| > build a SQL statement from the list of field names. A few have to be changed
| > by hand but not a big deal.

If you can show us what the data looks like and how you want it
parsed, it can help in building an re for it.  Right now I can't
suggest anything for parsing the data because I don't know how the
data looks.
| > Also needed...a link to RE examples. Its one thing to read the syntax and
| > quite another to gleam actual uses from them. Real world examples really
| > help and anything offered would be greatly appreciated.
| Hmm...
| Online I don't know about. I do know the O'Reilly's book,, _Mastering Regular
| Expressions_ is decent, though.

I second the recommendation of the O'Reilly book.  I have it and it is
excellent (though the python specific section is out-of-date).  It is
what I learned regexes from.