Skip to content

Instantly share code, notes, and snippets.

@gipi
Created November 22, 2011 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gipi/1385287 to your computer and use it in GitHub Desktop.
Save gipi/1385287 to your computer and use it in GitHub Desktop.
Simple python script to strip not whitelisted tags from a stream
import re, sys
for line in sys.stdin:
print re.sub(r"<(?![ ]*/?[ ]*(p|br)\b)[^>]*>", "", line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment