On Jan 19, 2:04 pm, tom <badoug...@gmail.com> wrote:
> trying to figure out how to solve what should be an easy python/regex/
> wildcard/replace issue.
> but i'm missing something...

Well, some would say you've missed the most obvious solution of _not_
using regexps :)

I'd probably do it via string methods wrapped up in a helper function:

>>> def extract(text):
...   first, rest = text.split('<', 1)
...   ignore, last = rest.rsplit('>', 1)
...   return '%s foo %s' % (first, last)
...
>>> extract('Soo Choi</span>LONGEDITBOX">Apryl Berney')
'Soo Choi foo Apryl Berney'
>>> extract('Soo Choi</span>LONGEDITBOX">Joel Franks')
'Soo Choi foo Joel Franks'
>>> extract('Joel Franks</span>GEDITBOX">Alexander Yamato')
'Joel Franks foo Alexander Yamato'



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to