Hi Ninjas,

I am a new HOF user who has lurked here, and benefited from much knowledge
in the past... and I am in a bit of a pickle.

I have a text string saved in a SQL DB which is the body text for a CFMAIL
tag.  This string contains variable names surrounded by pound characters.

I need to make this string user editable though, and thus need to have my
string parsed through, such that all the variable names are displayed as
string concatented elements in the cfm template (I'll be looping through the
GetNames query to send the mail).

Sample string:
Dear #GetNames.FirstName#,<BR>Thank you for purchasing #GetNames.Quantity#
widgets on
#DateFormat(Now(),"dd/mm/yy")#.<BR>Sincerely,#GetNames.ContactPerson#

This string needs to be then displayed within a CFOUTPUT such that the parts
can be put back together, and the various query results can be output:

"Dear " & #GetNames.FirstName#&",<BR>Thank you for purchasing " &
#GetNames.Quantity# & "widgets on " & #DateFormat(Now(),'dd/mm/yy')# &".
<BR>Sincerely," & #GetNames.ContactPerson#

I wanted to just replace every other occurance of a # character with " & and
then somehow the closing # chars with & " to build the new string for
output.

My question... can RegEx do something like this in a loop, where it finds
the first occurance of a # char, replaces it with X and then goes on to find
the next occurance and replaces it with Y and then finds the next occurance
and replaces it with X and the next with Y and so on??

Thank you for any help you can provide.  I will be eagerly awaiting a reply.

Robert Fish
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to