How can I use a single search / replace to replace all words town with village preserving the case of the first letter in this sentence:
Towns are small cities. I live in a town.

|
How can I use a single search / replace to replace all words
|
|||||
|
|
(And uncheck ignore case in the dialog)
|
|||||||||||||
|
|
I'm on my work machine right now, so no TextMate here for me to test on, but i think this might do what you want:
(Make sure to untick 'Ignore case' first.) Explanation: The 'Find' pattern searches for the letters The replace pattern uses conditional insertions to determine what to replace the text by. In pseudo-code the replace string says basically:
(And then it adds It's ugly, but i think it will probably work for the example you gave anyway. |
|||||||
|