HELP: String manipulation question from a newbie

Alex cut_me_out at hotmail.com
Wed Aug 16 12:50:19 EDT 2000


There have been a couple of other posts that recommend using string, but
they don't address your requirement that only strings called URL be
changed.  You might want to try something like this untested code,
instead:

import re
text = what_you_do_to_get_the_text()

text = re.replace('(URL="[^"]*)body_([^"]*")', '\1\2', text)

You may have to fiddle with it a bit to get it to work, though.

Alex.

-- 
To succeed in the world it is not enough to be stupid; you must also be
well-mannered. -- Voltaire




More information about the Python-list mailing list