Hi Jeremy, Here is how I do it in CF4em to replace things like [code]some
code[/code]

Loop the string, replacing the blocks with a marker and storing the name in
an array (the array position would match the marker)
Then you can loop the array, convert the names to links and put them back
into their original places with replace(str, '**marker1**', newLink, 'all')

You can download cf4em (http://cf4em.com/downloads) and view
/inc/parsebbml.cfm for some working code.

Specifically, check out how code blocks, url blocks, and encryption blocks
are removed, modified and put back into place. You could probably do both at
once and skip the array in your case.

A regex for your case would look like: <email>(.*?)</email>


..:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com


-----Original Message-----
From: Jeremy Prevost [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 19, 2008 5:43 PM
To: CF-Talk
Subject: Complex RegEx help request

Hi all. I'm hoping someone can help out with this problem I've run into.

I'm trying to make our home grown CMS a bit easier to use for our
editors and easier to maintain. The issue at hand involves how we code
email addresses into the content. I have an even that pops up a new
contact window (CFwindow) and takes a Firstname and Lastname
parameter. From there when the form is filled out the model looks up
the email address based on the firstname/lastname combo and that all
works great. However, I now want to tweak the code just a bit and will
need to do some interesting find/replace work on the db side...which
isn't a huge deal but I'd rather avoid doing it again every time I
need to make changes.

My thought was to use a pseudo tag such as <email>Firstname
Lastname</email> which would be really easy for our editors to use and
I'd replace that pseudo tag at display time with the actual link to
the cfwindow. That works great in my mind, but I'm having a heck of a
time creating a RegEx that will do what I want.

In summary, anyone have any pointers as to which direction I should go
to turn this:

<email>Firstname Lastname</email>

into this:

<a
href="javascript:ColdFusion.Window.create('staffContact#FirstName##Lastname#
','Contact%20#Firstname#%20#Lastname#','/index.cfm?event=page.comment&firstn
ame=#firstname#&lastname=#lastname#',{center:true,height:400,width:600,modal
:false,closable:true,draggable:true,resizable:true,center:true,initshow:true
,minheight:200,minwidth:200})">Email
#Firstname# #Lastname#</a>

Any thoughts would be much appreciated!

Thanks,
Jeremy



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305675
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to