Blair's example works but assumes your search term will always appear
after a '>' (not necessarily immediately after the '>').

So,
I am throwing a <span style="color:red;">spanner</span> in the works
Becomes ...
I am throwing a <span style="color:red;"><b>span</b>ner</span> in the
works

But in this scenario ...
Look a spanner, I am throwing the <span style="color:red;">spanner</
span> in the works. Anyone seen my spanner?
Becomes ...
Look a spanner, I am throwing the <span style="color:red;"><b>span</
b>ner</span> in the works. Anyone seen my <b>span</b>ner?

The first occurence of 'span' is not bold because it doesn't appear
after a '>'. Here is another option - this replaces any occurence of
'span' that does not appear after '<' or '</'

<cfset myString = 'Look a spanner ... I am throwing the <span
style="color:red;">spanner</span> in the works. Anyone seen my
spanner?' />
<cfset sSearchTerm = "span">
<cfoutput>#myString#<br /></cfoutput>
<cfset myString = REReplaceNoCase(myString,"([^<?/])
(#sSearchTerm#)","\1<b>\2</b>","all") />
<cfoutput>#myString#<br /></cfoutput>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to