python search replace using wildcards
Posted
by tom smith
on Stack Overflow
See other posts from Stack Overflow
or by tom smith
Published on 2010-01-19T00:00:22Z
Indexed on
2010/06/05
18:02 UTC
Read the original article
Hit count: 435
hi
somewhat confused.. but trying to do a search/repace using wildcards
if i have something like:
<blah.... ssf ff>
<bl.... ssf dfggg ff>
<b.... ssf ghhjj fhf>
and i want to replace all of the above strings with say,
<hh >t
any thoughts/comments on how this can be accomplished?
thanks
update (thanks for the comments!)
i'm 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
i've tried derivations of
name=re.sub("</s[^>]*\">"," foo ",name)
but i'm missing something...
thoughts... thanks
© Stack Overflow or respective owner