need help of regular expression genius

GHUM haraldarminmassa at gmail.com
Thu Aug 3 03:43:16 EDT 2006


Paul,

> text = """ ... input source text ... ""
> from pyparsing import SkipTo,Literal,replaceWith
> ign1 = "$$" + SkipTo("$$") + "$$"
> ign2 = "$_$" + SkipTo("$_$") + "$_$"
> semi = Literal(";").setParseAction( replaceWith("; <***>") )
> print (ign1 | ign2 | semi).transformString(text)

Thank you very much! this really looks beautifull and short! How could
I forget about pyparsing? Old loves are often better then adventures
with RE. :)

Two questions remain:
1) I did not succeed in finding a documentation for pyparsing. Is there
something like a "full list of Classes and their methods" ?

2) as of missing 1) :)): something like
"setParseAction(splithereandreturnalistofelementssplittedhere) ?

 Thanks again!

Harald

(of course, I can .split("<***>") the transformedString :)




More information about the Python-list mailing list