Hopefully this should be an easy and quick answer.
I want to call a function on a regex backreference, ie:
REreplace(string,regex,function('\1'),'ALL');
is this possible? I've tried every imaginable combination to make it work, and
its just not happening!!!
Thanks,
Ryan
On 11/2/06, Ryan Mitchell [EMAIL PROTECTED] wrote:
Hopefully this should be an easy and quick answer.
I want to call a function on a regex backreference, ie:
REreplace(string,regex,function('\1'),'ALL');
is this possible? I've tried every imaginable combination to make it work,
and its
hmm, see that wouldn't work.
im looping through a string, replacing emails with an obfuscated/hidden version
of the email address... so i need to call the function directly...
~|
Introducing the Fusion Authority Quarterly
On 11/2/06, Ryan Mitchell [EMAIL PROTECTED] wrote:
hmm, see that wouldn't work.
im looping through a string, replacing emails with an obfuscated/hidden
version of the email address... so i need to call the function directly...
If context is important, try posting a larger snippet. Maybe that
It will work on the whole string, not just the back reference.
Ryan, I don't think it's something that can be done with CF,
but it might be possible to use Java's regex instead.
Have a look at these two blog entries which might help:
http://www.bennadel.com/index.cfm?dax=blog:301.view
ok, so i have a long string with emails within it, what i want to do is
identify the emails in teh string, and replace them with the result of the
function obfuscate(email)...
so what im doing is this:
function hideEmails(s) {
return rereplace(s,(mailto:)([EMAIL
wonderful... the java solution worked a treat! thanks!
~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
Peter is right. Now that I see what you're trying to do, I don't
think it can be done in CF. I'm don't think it can be done in Java,
either. To perform multiple actions within a single string (which
you're doing since you're assuming multiple matches), you'll need to
use REFind() and loop over
On 11/2/06, Ryan Mitchell [EMAIL PROTECTED] wrote:
wonderful... the java solution worked a treat! thanks!
Would you mind posting the final code? I'd like to see how that operates.
Thanks.
~|
Introducing the Fusion Authority
no problem:
jrereplace(s,(mailto:)([EMAIL PROTECTED]),helper,'ALL');
the helper is a reference to a function, which takes 2 params, 1 is the full
matched string, 2 is an array of the portions to the matched string:
function helper(s,g) { return obfuscate(s); }
the jrereplace is defined as:
im looping through a string, replacing emails with an
obfuscated/hidden version of the email address.
I may have a simpler solution:
I have these CF and JS functions in Application.cfm:
/CFSCRIPT
function hideAddress(address)
{
return replace(replace(address, @, $), ., ;, all);
}
I forgot to mention this to put a mailto in your code, use:
A HREF=mailto:#hideAddress(infoEmail)# onClick=getInfo(this)
--
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this
12 matches
Mail list logo