testing 

-----Original Message-----
From: Mark Henderson [mailto:m...@cwc.co.nz] 
Sent: Monday, November 16, 2009 4:29 PM
To: cf-talk
Subject: RE: Regex help with invalid HTML


Azadi Saryev wrote on 16 November 2009 at 17:58

> you can do it with something like this:
> <cfset line='<tr><td class="l"><a href="/">blah.com</a><td>31
622<td>25
> 623<td>193 645<td>840 642<td>1.9 GB'>
> <cfset cleanline = rereplace(line, '<t[^>]+>', '|', 'all')> 
> <cfoutput>#listfirst(cleanline, '|')# #listlast(cleanline,
'|')#</cfoutput>
> 
> and if you do not want any html in final result (not even <a> tag),
then
> use:
> <cfset cleanline = rereplace(line, '<[^>]+>', '|', 'all')>
> 

Thanks Azadi. That's all I needed to get the thought processes rolling in
the right direction (it never occurred to me to check each entry was on a
new line, so thanks also to the individual I can only refer to as list!). 

Here's the truncated code relevant to the question I asked that's
working:

<cfhttp url="http://localhost/statsmerged.html";>

<cfset sStartString = cfhttp.filecontent> <cfset sStartTag = FindNoCase("<td
class='l'>", sStartString)> <cfset sTempString = RemoveChars(sStartString,1,
sStartTag-1)> <cfset sEndTag = FindNoCase("</table>", sTempString)> <cfset
sFinalString = RemoveChars(sTempString,sEndTag, Len(sTempString))>

<cfloop index="thisLine" list="#sFinalString#"
delimiters="#chr(10)##chr(13)#">
  <cfset cleanLine = ReReplace(thisLine, '<[^>]+>', '|', 'all')>
  <cfoutput>#listFirst(cleanLine, '|')# #listLast(cleanLine,
'|')#</cfoutput> </cfloop>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328451
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