[Zope-CMF] Pythonish Questions
Chris Withers
chrisw@nipltd.com
Tue, 01 May 2001 15:05:07 +0100
Jon Edwards wrote:
>
> Chris Withers has recently posted a method he uses for stripping
> HTML in Squishdot; I would search the list archives for it.
>
> Jon >> Thanks, I'll take a look. So there's no Zope/Python function that
> would do this? ...kinda the reverse of the one that parses StructuredText to
> HTML? <<Jon
The function to do this is html2text in stripogram.py (get it from Squishdot's
CVS on sourceforge, the one there actually works ;-)
However, for what you want the following regular expression-based function
should work fine (damn, you can't use re's in Python Scripts *grumble* *moan*
;-)
tagRegex = re.compile("<.*?>")
def striptags(self,s):
return tagRegex.sub("",s)
cheers,
Chris