I don't think it is working yet!That seems to work better..
I did it so that words within words work but not words alone.
Hence why you can type Scunthorpe but not: Well you get the idea.
I mainly used replacement variables and curly braces around single words.
Some words you can qualify just by using parentheses alone.
Well done spotting \b Hombre! I have no problem with you improving my code and I have learnt something new. I still can't see why my version misses the cases you highlight above but life is too short to worry about it.s/\btherword\b/osr/i
seems to be the answer.
Okay, it turns out life is not too short! For the record, the reason s/(^|\W+)therword($|\W+)/\1osr\2/i failed was that the \W+ gobbles up all of the spaces following "therword" so if the next word happens to be the therword again, it is not matched because there is not at least one space preceding it. It would have worked in most reasonable cases but Hombre's version is better.but life is too short to worry about it.