Tuan writes: 

> Can somebody explain what the difference is between the REReplace and Replace 
>function?  Im confused when to use one or the other and their differences.  

replace() is a simple function to replace one character (or string of 
characters) with another. 

for example, in the string "the quick brown fox jumped over the lazy dog", 
you could replace the word 'fox' with 'goldfish' by doing: 

<cfset mystring = "the quick brown fox jumped over the lazy dog">
<cfset myNewString = replace(myString, "fox", "goldfish", "all")> 

 ------------------------------------ 

reReplace() uses regular expressions (pattern matching) to determine what 
item/string/characters to replace.  Instead of specifying a particular 
string/character to be replaced, you can specify a pattern (for example, the 
word 'foo' only if it's the last word in a sentence). 

I unfortunately still haven't fulfilled my ambition of learning regular 
expressions...but I'm sure that Ben Doom, the cf-talk RegExp Ninja (tm) will 
be happy to elaborate there :) 

Charlie 


>  
> 
>  
> 
>  
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to