Replace word in string but keep the case the same and complete words only in asp.net vb
Posted on 2010-08-13
I am currently working on a website that will create websites for my firm andi am stuck.
On the website, whenever a few certain words are mention, it is hyperlinked. This is done by me hardcoding.
I know the basic replace(string,"myWord","<a href etc>") , however, this does a few things that i need to work round.
Firstly, If the string has a word i want to replace is Adult and the word in the string is adult, it changes it to a capital A.
Also, taking the same word to replace, if the word in the string is Adultery it will replace the Adult, but i would not want it replaced.
So is there a way of keeping the case when replacing a string and also is there any way of making it match the whole word only..
I hope this makes sense.