I want to replace XML tags, with a sequence of repeated characters that has the same number of characters of the tag.
For example:
<o:LastSaved>2013-01-21T21:15:00Z</o:LastSaved>
I want to replace it with:
#############2013-01-21T21:15:00Z##############
How can we use RegEx for this?
re.subaccepts a function as replacement:Here’s an example:
The pattern I used may need some polishing, I’m not sure what’s the canonical solution to matching XML tags is. But you get the idea.