Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
_el_Jefe #1
help my string
Running MX6.1 So I've got this .TXT that I'm CFFILE reading into memory (at
some point this data will probably be in a DB). The TXT has some basic visual
formatting to it. I'm doing: <cfset Variables.foo = #Replace(Variables.foo,
chr(13) & chr(10), '<br>', 'ALL')#> and this output looks just the way I
want it to in the browser. But here's the kicker: I need to loop throug this
string, and take any copy as it may appear between a pair of <br> tags and turn
it into hyperlink, with the link looking something like this: <a
href='foo.cfm&section=#LoopCount#'>bunch of copy</a>. For example. From
this: <br> To make it truster of your own report<br> Against yourself: I know
you are no truant.<br><br><br> But what is your affair in Elsinore?<br> We'll
teach you to drink deep ere you depart.<br><br> To this: <br> <a
href='foo.cfm&section=457'>To make it truster of your own
report</a><br><br><br> <a href='foo.cfm&section=458'>Against yourself: I
know you are no truant.</a><br> <a href='foo.cfm&section=459'>But what is
your affair in Elsinore?</a><br> <a href='foo.cfm&section=460'>We'll teach
you to drink deep ere you depart.</a><br><br> Ya dig? My regular expression
skills are hit or miss, and I'm not having much luck at the moment. Any help or
suggestions would be greatly appreciated. Thanks in advance.
_el_Jefe Guest
-
Maintain query string and somehow auto refresh a pagewith that string intact
I have a drill down where on page one the user selects criteria to narrow down the search for a speicific group of employees(like all hired between... -
#7056 [Com]: Setting string variables to value starting with '<' cause string to be empty.
ID: 7056 Comment by: davidgjenkins at ntlworld dot com Reported By: tammy at synchronis dot com Status: Closed... -
string question: how to append x zeros to get fixed lenght string?
"Bob Barrows" <reb_01501@yahoo.com> wrote in message news:uuhVv4mcDHA.656@tk2msftngp13.phx.gbl... newstring = Right("0000000" & i,8) ;-p -
Cannot create an object of type 'System.String[]' from its representation 'String[] Array'
Hello, I am designing a .net custom control in VS.net 7.1 and my control exposes an array of strings which are supposed to be the items to show. To... -
String question: Returning portion of string with words surrounding highlighted search term?
I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string,... -
eastinq #2
Re: help my string
Basically a 2 step process. A regular expression replace and then loop to add
increment.
Assuming your whole text is stored in variable mytext, this code should work.
<cfset mytext2 = REReplace(mytext,"([>][[:cntrl:] ]?)([^<]+)","\1<a
href='foo.cfm§ion=ZZZ'>\2</a>","ALL")>
<cfset counter = 458>
<cfloop condition = "Find('ZZZ',mytext2) neq 0">
<cfset mytext2 = Replace(mytext2, "ZZZ", counter)>
<cfset counter = counter + 1>
</cfloop>
<cfoutput>#mytext2#</cfoutput>
eastinq Guest
-
_el_Jefe #3
Re: help my string
YEAH! That's what I'm talkin about! eastinq YOU ROCK! I had to make a couple
changes, but your regex is dope!
<cfset Variables.foo = #Replace(Variables.foo, chr(13) & chr(10), "<br>",
"ALL")#>
<cfset Variables.foo = REReplace(Variables.foo,"([>][[:cntrl:]
]?)([^<]+)","\1<a href='foo.cfm§ion=ZZZ'>\2</a>","ALL")>
<cfset counter = 1>
<cfloop condition="#Find("ZZZ", Variables.foo)# NEQ 0">
<cfset Variables.foo = Replace(Variables.foo, "ZZZ", counter)>
<cfset counter = counter + 1>
</cfloop>
<cfoutput>
#Variables.foo#
</cfoutput>
_el_Jefe Guest



Reply With Quote

