This content has been marked as final. Show 10 replies
You can use the CF List functions to parse the string. Using "(" and ")" as delimiters will allow you to parse the ClientID-nnnn occurrences in the string. Within that, using "-" as the delimiter will allow you to isolate the numeric portion. From that you can build the HTML for the link. The use Replace function to replace the original string with the HTML.
Here is a fully worked out example. It runs through quite a few themes. Have a look. There are a number of ways to customize it and make it your own.
BKBK, you the man (or woman)... I actually got this working and it's similar to your code, but yours is MUCH cleaner... I was doing the same thing with a cfloop, cfabort and using a list with a funky " " delimiter. Trust me, the code was funky, but it kind of worked (as a concept) until you helped me out. THANKS!
BKBK,,, I have another one along the sames lines for you... If you could help me out.
I've tried to work this out myself and either can't figure out the looping or the regular expression.
I want to search a string for a 9 charactor string that starts with "06, 07, 08, or 09". I couldn't find a way to delimit the items like before as sometimes theres a space, a comma, or other charactor.
Ie. String ="Look up event 081241223, 081251222 and 071002120. The current event=093121923."
Should be (pysdo) = "Look up event <a href=page.cfm?id=081241223>081241223</a>, <a href=page.cfm?id=081251222>081251222</a> and <a href=page.cfm?id=071002120>071002120</a>. The current event=<a href=page.cfm?id=093121923>093121923</a>."
What is your code for String ="Look up event 08-1241-223, 081251222 and 07.1002120. The current event=09.312.1923."?
I'm collecting the string from user input. The string is just being queried from a database.
I figured out the regular expression I want, but I'm having an issue with looping and replacing. This is what I have so far:
It's getting more ad hoc.
I don't know where you got the "08-1241-223, 07.1002120 or 09.312.1923" strings from... The strings that I will be looking for are all just 9 numbers with no punctuation. So, I didn't need the first two "replace" tags you gave me.
I modified your code to look for my number string as long as it doesn't start with a "=" or ">" (used in my link). I instructed the end users not to enter the number like "blah=083212333".
Here is my finished code:
I don't know where you got the "08-1241-223, 07.1002120 or 09.312.1923" strings from...
Force of habit. I've often had to desanitize telephone numbers like that. When you said, "a way to delimit the items like before as sometimes theres a space, a comma, or other charactor.", I thought you meant there could be characters that delimit the sequence of integers. I now know what you meant.
I modified your code to look for my number string as long as it doesn't start with a "=" or ">" (used in my link).
OK. The trick is to search with a regex that the replacement strings will never match. Otherwise you'll risk ending up in an infinite loop.