The method I've described is the only only way I know to process a regex
match with a function before replacing the string. Perl and maybe php
support that kind of functionality, but in most languages it takes a
work-around.

Blair

On 8/23/07, Steve Onnis <[EMAIL PROTECTED]> wrote:
>
>  Blair
>
> Not really what i was looking for because then i would have to escape and
> other hashes in the string because if i didnt the valuate would error
>
> for example if the string was
>
> my name is <span style="color:#c0c0c0">steve</span> and my email address
> is [EMAIL PROTECTED] so if you want to email me go for it
>
> then as soon as i evaluated the string it would error because of the un
> escaped # in the font color, which would mean i would need to escape all the
> hashes rendering the cfoutput # useless.
>
> I need to be able to inject the new value directly into the REreplace so i
> am only updating what i need
>
>
>
>
>  ------------------------------
> *From:* cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Blair McKenzie
> *Sent:* Thursday, 23 August 2007 12:34 PM
> *To:* cfaussie@googlegroups.com
> *Subject:* [cfaussie] Re: Evaluating regular expression back references
>
> Ooooh. I think there was a thread on this a while back - if you search the
> list for rereplace and eval it should come up.
>
> The gist is that instead of running the function (mask in your case)
> directly in the rereplace, you replace the found string with an embedded
> function, so the replacement string would be something like
> "##mask('[EMAIL PROTECTED]')##"
> and the result would be something like
> "my name is steve and my email address is #mask('[EMAIL PROTECTED]<[EMAIL 
> PROTECTED]>')#
> so if you want to email me go for it"
> Then you eval the result of the rereplace. There might be a DE in there
> somewhere too. I forget.
>
> Blair
>
> On 8/23/07, Steve Onnis <[EMAIL PROTECTED]> wrote:
> >
> >  yeah but i need to only replace the email address our of a string so
> > the string would be fore example
> >
> > "my name is steve and my email address is [EMAIL PROTECTED] so if you
> > want to email me go for it"
> >
> > I need to be able to extract the email address which is what the regular
> > expression does.  The email address could be anything so i want to be able
> > to pass the back references from the regular expression into another
> > function and be able to pass that back into the REReplace so i dont have to
> > loop over the string looking for email addresses.  Keep in mind that the
> > string would be an entire HTML page.
> >
> > Make sense?
> >
> >  ------------------------------
> > *From:* cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] *On
> > Behalf Of *Blair McKenzie
> > *Sent:* Thursday, 23 August 2007 12:14 PM
> > *To:* cfaussie@googlegroups.com
> > *Subject:* [cfaussie] Re: Evaluating regular expression back references
> >
> >  You may be over thinking the problem. Replace already takes the whole
> > string. For that matter REReplace also takes the whole string and only
> > replaces the match - you could use
> > rereplace('[EMAIL PROTECTED]@als,'@','&123','ALL')
> > and it would still return the entire string.
> >
> > And I'm pretty sure replacelist replaces every occurrance. You just have
> > to watch out for recursive replacements.
> >
> > Blair
> >
> >
> > On 8/23/07, Steve Onnis <[EMAIL PROTECTED]> wrote:
> > >
> > >  I need to pass the whole string into the function as i want to
> > > replace every character in the email address with its&# value so i need to
> > > be able to evaluate the back references to the values of the back 
> > > references
> > > are passed into the function
> > >
> > >  ------------------------------
> > > *From:* cfaussie@googlegroups.com [mailto: [EMAIL PROTECTED]
> > > *On Behalf Of *Blair McKenzie
> > > *Sent:* Thursday, 23 August 2007 10:10 AM
> > > *To:* cfaussie@googlegroups.com
> > > *Subject:* [cfaussie] Re: Evaluating regular expression back
> > > references
> > >
> > >  If you're only replacing symbols you don't really need regex.
> > > For most symbols, just replace them with their &## counterpart:
> > > replacelist(str, "@,%", "&#asc('@')#,&#asc('%')#")
> > >
> > > If you need to replace &s you need to make sure to do so before any
> > > other symbols.
> > >
> > > Blair
> > >
> > > On 8/22/07, Steve Onnis < [EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > >
> > > > What I am trying to do is replace all values in a string with the &#
> > > > value
> > > > of the character.  This is what I have so far...
> > > >
> > > > -----------------------------------------------------------
> > > > <cfsavecontent variable="str">
> > > >         this is my email address <a
> > > > href="mailto: [EMAIL PROTECTED]"> [EMAIL PROTECTED]</a>
> > > > </cfsavecontent>
> > > > <cfset reg = "([[:alnum:]|\.]*)@([[:alnum:]|\.]*)" />
> > > > <cfscript>
> > > >         function mask() {
> > > >                 var str = arguments[1];
> > > >                 var i = 1;
> > > >                 var length = LEN(str);
> > > >                 var returnStr = "";
> > > >                 for (i=1; i LTE length; i=i+1) {
> > > >                         returnStr = returnStr & "&###ASC(MID(str, i,
> > > > 1))#";
> > > >                         }
> > > >                 return returnStr;
> > > >                 }
> > > > </cfscript>
> > > > <cfoutput>
> > > > #REReplaceNoCase(str, reg, mask("[EMAIL PROTECTED]"), "ALL")#
> > > > </cfoutput>
> > > > -----------------------------------------------------------
> > > >
> > > > If I just return the "str" value it returns the email address but is
> > > > I loop
> > > > over the string I get "[EMAIL PROTECTED]" returned as the string.
> > > >
> > > > Is there a way around this?
> > > >
> > > > Steve
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
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