That's not quite what I've got going on. Notice that while you used
backreferences, you didn't *process* them at all. (Maybe that's how I
should have phrased it: "Is it possible to *process* backreferences
within REReplace?")

Please remember that AFAIK, what I'm asking about is impossible, but I
was just making sure. Also, please note that I don't need help getting
this to work in another way (i.e. with a loop), as I have already made
a UDF that does it the "hard" way.

<cfsavecontent variable="myString">
[EMAIL PROTECTED] hello [EMAIL PROTECTED] goodbye
</cfsavecontent>
<cfscript>
// keep in mind that this is just illegal pseudocode
myString = rereplace(str,
          "([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+",
          emailAntiSpam(\1),
          "all");
</cfscript>
<cfoutput>
#myString#
</cfoutput>

############### DESIRED YIELD ###############
&#102;&#111;o&#64;&#98;a&#114;&#46;c&#111;&#109; hello
&#106;&#105;m&#64;&#106;a&#109;&#46;c&#111;&#109; goodbye

Thanks,
Jamie

On Fri, 6 Feb 2004 06:11:30 +1000, in cf-talk you wrote:

>Yeah you can use back references, it would be something like the following
>Pseudo code:
>your spam email = "taco at coldfusionist.com"
>
>find (\.*)\sat\s(\.*)
>replace with [EMAIL PROTECTED]
>
>The regex needs adjustment, but it displays how the back references could do
>the trick
>
>
>Taco Fleur
>Blog  <http://www.tacofleur.com/index/blog/>
>http://www.tacofleur.com/index/blog/
>Methodology http://www.tacofleur.com/index/methodology/
>
>Tell me and I will forget
>Show me and I will remember
>Teach me and I will learn
>
>-----Original Message-----
>From: Jamie Jackson [mailto:[EMAIL PROTECTED]
>Sent: Friday, 6 February 2004 4:32 AM
>To: CF-Talk
>Subject: REReplace: Manipulating Backreferences
>
>
>I just wrote a UDF to do a rereplace with manipulated backreference
>values. Specifically, it replaces all instances of email addresses in
>a string with "antiSpam" email addresses.
>
>However, I'm wondering if there was an easier way...
>
>Is there any magic shortcut, similar to this (illegal) pseudo-code?
>(i.e. Is there a way to manipulate the backreferenced value within the
>rereplace function?)
>
>rereplace(str,
>          "([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+",
>          emailAntiSpam(\1),
>          "all");
>
>Thanks,
>Jamie
>  _____  
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to