Yep,
Worked that out also, this seems to work for me, just need an inner loop
over the cells.
<cfloop condition="#reFindNoCase('<tr>.*?</tr>', html, pos)#">
<cfset posArray = reFindNoCase('<tr>.*?</tr>', html, pos, true) />
<cfset pos = posArray.pos[1]+1 />
<cfset posStruct = {} />
<cfset posStruct.pos = posArray.pos[1] />
<cfset posStruct.len = posArray.len[1] />
<cfset arrayAppend(result, posStruct) />
</cfloop>
Regards
Dale Fraser
<http://learncf.com/> http://learncf.com
<http://flexcf.com/> http://flexcf.com
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Steve Onnis
Sent: Monday, 24 November 2008 5:29 PM
To: [email protected]
Subject: [cfaussie] Re: Pull apart a html table
By the way with this regular expression all you will get is the first and
last row because you are looking for anything that is not a ">" with
anything inbetween ending in "</tr>" so it end up getting the whole table
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Monday, 24 November 2008 4:32 PM
To: [email protected]
Subject: [cfaussie] Re: Pull apart a html table
I just need to get the content out, I know there is a fixed format to the
tables, each row has three cells, and I need to extract the info from each
cell and populate a database.
I've been playing at regex to get all the rows to start with but having
trouble, I have
<cfset result = reFind("<tr[^>]*>(.*?)</tr>", html, 1, true) />
<cfdump var="#result#" />
But it only returns 2 elements in the array and there are hundreds of rows.
Regards
Dale Fraser
http://learncf.com <http://learncf.com/>
http://flexcf.com <http://flexcf.com/>
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Steve Onnis
Sent: Monday, 24 November 2008 4:24 PM
To: [email protected]
Subject: [cfaussie] Re: Pull apart a html table
what are you wanting to do with them?
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Monday, 24 November 2008 4:19 PM
To: [email protected]
Subject: [cfaussie] Pull apart a html table
Is there an easy way to pull apart an html table.
I have a heap of html where I need to loop through the html and get a
specific table and then loop over the rows and columns.
I could write all that code, but I feel like I would be reinventing the
wheel, is this something that could be done with a regex or outside the
scope?
Regards
Dale Fraser
http://learncf.com <http://learncf.com/>
http://flexcf.com <http://flexcf.com/>
<BR
<BR
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---