Max M wrote:
If it's not to learn, and you simply want it to work, try out this
library:
http://zope.org/Members/chrisw/StripOGram/readme
stripogram.html2safehtml('''first last''',valid_tags=('i','a','br'))
'first last'
stripogram.html2safehtml('''first last''',valid_tags=('i','a','br'))
Hello,
I want to remove all html tags from a string content except a
...xxx/a.
My script reads like this:
###
import re
content = re.sub('([^!]([^]|\n)*)', '', content)
###
It works fine. It removes all html tags from content.
Unfortunately, this also removes a ...xxx/a occurancies.
Any idea,
How about...
import re
content = re.sub('([^!(a)]([^(/a)]|\n)*)', '', content)
Seems to work for me.
HTH
-Anand
--
http://mail.python.org/mailman/listinfo/python-list
I meant
content = re.sub ('[^!(a)]([^]|\n)*[^!(/a)]', '', content)
Sorry for the mistake.
However this seems to also print tags like b, p etc
also.
-Anand
--
http://mail.python.org/mailman/listinfo/python-list
Nico Grubert wrote:
If it's not to learn, and you simply want it to work, try out this library:
http://zope.org/Members/chrisw/StripOGram/readme
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list