How to find/replace text in html while preserving html tags/structure

Posted by vbfoobar on Stack Overflow See other posts from Stack Overflow or by vbfoobar
Published on 2009-12-06T17:44:58Z Indexed on 2010/05/15 9:04 UTC
Read the original article Hit count: 902

Filed under:
|
|

I use regexps to transform text as I want, but I want to preserve the HTML tags. e.g. if I want to replace "stack overflow" with "stack underflow", this should work as expected: if the input is stack <sometag>overflow</sometag>, I must obtain stack <sometag>underflow</sometag> (i.e. the string substitution is done, but the tags are still there...

© Stack Overflow or respective owner

Related posts about python

Related posts about html