file/re search and sub problem

tiddlerdeja at my-deja.com tiddlerdeja at my-deja.com
Wed Jun 28 15:54:14 EDT 2000


Any help appreciated...

I have a re:
wilf_re        = re.compile('[^A-Z]ebitda[^A-Z]', re.IGNORECASE)

And I do a search and replace
if wilf_re.search(file):

     # perform the substitution
     new_file = wilf_re.sub(" EBITDA", file)

This isn't really what I want. If I have
 ebitda</td>
It replaces it with
 EBITDA/td>


Can someone tell me how I go about getting:
 EBITDA</td>


Any help geatly appreciated.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list