Created
August 11, 2011 15:26
-
-
Save BaseCase/1139936 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| with_style = '<div style="things and stuff" class="whatnot">hi there</div>' | |
| without_style = re.sub(r"""style=('|")(.*)\\1""", '', with_style) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So the goal is to strip out all 'style' attributes. Since you can have either ' or " as a quote in html, I'm trying to use that first group to catch which one is being used and then use the same one at the '\1', which is supposed to represent the first group that was matched. For some reason, this doesn't work...without_style is the same string as with_style.
Wha happen?!