HELP: String manipulation question from a newbie

Bill Scherer Bill.Scherer at VerizonWireless.com
Wed Aug 16 13:09:08 EDT 2000


Keep also in mind that string.replace will generally be faster than
re.replace.

You have a choice of working solutions, and choosing the right one is now
your task.
Which one is 'right' all depends on your problem and the constraints you
place on solving it.


-Bill

Alex wrote:


> 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
>
> --
> http://www.python.org/mailman/listinfo/python-list

--
William K. Scherer
Sr. Member of Applications Staff - Verizon Wireless
Bill.Scherer_at_VerizonWireless.com







More information about the Python-list mailing list