I'm outputting text content to my page by querying our database using a simple method, which works fine. <cfoutput query="getPageContent" startrow="#vPageContent#" maxrows="1">#vContent#</cfoutput> Code (markup): I need to replace certain words to make them bold, for example... <cfset request.vContent = replace(request.vContent, "phrase", "<B>phrase</B>, "ALL")> Code (markup): This works, but there is a slight issue, because it will also replace occurances of the word 'phrase' even if it is within another word... for example, cophrasetastic So i need to replace only the exact phrase when used on it's own. My problem appears quite simple, but I have not found a way to do this...?
Change: replace(request.vContent, "phrase", "<B>phrase</B>, "ALL") To: replace(request.vContent, " phrase ", " <B>phrase</B> ", "ALL") If you want to catch commas and punctuation as well, then you can use a regex to match only the characters you want.