Your replace function needs to be able to identify and transform words in the text. This is not trivial, as the concept of words is not trivial, depending on your requirements.
As an example, let's say you want to replace the word "foo" with "bar" in the following string:
let str = "Yeti says 'foo', and bigfoot says 'bar'. What is foo? Foo is a word."
I guess you want the resulting string to be:
let res = "Yeti says 'bar', and bigfoot says 'bar'. What is bar? Bar is a word."
As you already mentioned, the solution must not turn "bigfoot" into "bigbart".
And getting the above result also requires a replace function that is able to deal accordingly with lowercase, uppercase, punctuation etc, so it's not enough to eg just split the string around whitespace and turn it into lowercase.
You might be interested in reading the NSHipster article about NSLinguisticTagger. The NSLinguisticTagger can be used to tokenize the input string, so you get a range for each word, no matter if it has punctuation or whitespace around it.
Regarding tokenizing using eg regular expressions, remember that it's naïve to think that words are made up of a-zA-Z, even if considering only english words, such as naïve or café, this is true for punctuation too, ie does your tokenizer think that façade is one word or that it is two words fa and ade separated by ç?
EDIT: OOPer's solution below, using regex word boundaries (\b) is able to handle the above mentioned cases, and is probably the best/easiest solution if you just want to blank out offending words.