python replace/sub/wildcard/regex issue

tom badouglas at gmail.com
Mon Jan 18 23:04:57 EST 2010


hi...

trying to figure out how to solve what should be an easy python/regex/
wildcard/replace issue.

i've tried a number of different approaches.. so i must be missing
something...

my initial sample text are:

Soo Choi</span>LONGEDITBOX">Apryl Berney
Soo Choi</span>LONGEDITBOX">Joel Franks
Joel Franks</span>GEDITBOX">Alexander Yamato

and i'm trying to get

Soo Choi foo Apryl Berney
Soo Choi foo Joel Franks
Joel Franks foo Alexander Yamato

the issue i'm facing.. is how to start at "</" and end at '">' and
substitute inclusive of the stuff inside the regex...

i've tried derivations of

name=re.sub("</s[^>]*\">"," foo ",name)

but i'm missing something...

thoughts... thanks

tom



More information about the Python-list mailing list