need help of regular expression genius

GHUM haraldarminmassa at gmail.com
Thu Aug 3 08:21:45 EDT 2006


Paul,

> Pyparsing ships with JPG and PNG files containing class diagrams, plus an
> htmldoc directory containing epydoc-generated help files.
> There are also about 20 example programs included (also accessible in the
> wiki).

Yes. That's what I have been missing. Maybe you could add: "please also
download the .zip file if you use the windows installer to find the
documentation" :)))

>You could also look into using scanString instead of transformString
thats what I found:
from pyparsing import SkipTo,Literal,replaceWith
ign1 = "$$" + SkipTo("$$") + "$$"
ign2 = "$_$" + SkipTo("$_$") + "$_$"
semi = Literal(";")

von=0
befehle=[]
for row in (ign1 | ign2 | semi).scanString(txt):
    if row[0][0]==";":
        token, bis, von2=row
        befehle.append(txt[von: von2])
        von=von2

I knew that for this common kind of problem there MUST be better
solution then my homebrewn tokenizer (skimming through text char by
char and remembering the switch to escape mode ... brrrrrr, looked like
perl)

Thanks for the reminder of pyparsing, maybe I should put in a reminder
in my calender ... something along the lines "if you think of using a
RE, you propably have forgotton pyparsing" every 3 months :)))))

Best wishes and thank you very much for pyparsing and the hint

Harald




More information about the Python-list mailing list