[Tutor] simple text replace

Che M pine508 at hotmail.com
Mon Jul 27 00:05:33 CEST 2009



> I am scanning a text file and replacing words with alternatives. My difficulty 
> is that all occurrences are replaced (even if they are part of another word!)..

Could you search for the string ' word ' with the white spaces around it?  Shouldn't
that only replace words that are not part of another word?

> Essentially, I would like to replace only the occurrence that is currently 
> selected-- not the rest. for example:


What do you mean by a word being "currently selected"?  That phrase and
"scanning a text file" don't make sense to me together.  How is the user 
reading the text to select the word that is to be replaced?  (Or maybe I am
not understanding something?)

CM

_________________________________________________________________
Bing™ brings you maps, menus, and reviews organized in one place. Try it now.
http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TXT_MLOGEN_Local_Local_Restaurants_1x1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090726/d2e86342/attachment.htm>


More information about the Tutor mailing list