|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
ColdFusion 8 code in ColdFusion 7
Hi... I need help making this CF8 code work in CF7.Web Exp 12/31/07 12:37 A how is it not working?Charlie Griefer 12/31/07 12:41 A REMatch() is new to CF8, as is the array attribute in cfloop.Adrian Lynch 12/31/07 02:05 A There are similar functions on CFLib. I believe reGetAll.Raymond Camden 12/31/07 11:15 A Hi... I need help making this CF8 code work in CF7. Can anyone help me with this? Here's the code: <cfset re1='.*?'> <cfset re2='((?:[a-z][a-z\.\d]+)\.(?:[a-z\d]+))(?![\w\.])'> <cfset re = #re1#re2#> <!--- read the html file ---> <cffile action="read" file="#expandPath('homepage.html')#" variable="htmldoc"> <!--- return an array of image tags ---> <cfset images = REMatchNoCase("<img([^>]*[^/])>", htmldoc)> <cfset files = arrayNew(1)> <cfloop array="#images#" index="i"> <cfset imgpath = REMatchNoCase(re, i)> <cfset imgpath = replace(imgpath[1],"""","","all")> <cfset tmp = structNew()> <cfset tmp.path = imgpath> <cfset tmp.filename = listLast(imgpath,"/")> <cfset tmp.fileExtension = right(imgpath,3)> <cfset tmp.filetype = "image"> <cfset arrayAppend(files,tmp)> </cfloop> <cfdump var="#files#"> Thanks, K how is it not working? On Dec 30, 2007 9:35 PM, Web Exp <webexp@gmail.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- REMatch() is new to CF8, as is the array attribute in cfloop. Change the cfloop to an indexed loop and use http://www.cftagstore.com/tags/cfreextract.cfm or similar for the RegEx extraction. Adrian http://www.adrianlynch.co.uk/ Hi... I need help making this CF8 code work in CF7. Can anyone help me with this? Here's the code: <cfset re1='.*?'> <cfset re2='((?:[a-z][a-z\.\d]+)\.(?:[a-z\d]+))(?![\w\.])'> <cfset re = #re1#re2#> <!--- read the html file ---> <cffile action="read" file="#expandPath('homepage.html')#" variable="htmldoc"> <!--- return an array of image tags ---> <cfset images = REMatchNoCase("<img([^>]*[^/])>", htmldoc)> <cfset files = arrayNew(1)> <cfloop array="#images#" index="i"> <cfset imgpath = REMatchNoCase(re, i)> <cfset imgpath = replace(imgpath[1],"""","","all")> <cfset tmp = structNew()> <cfset tmp.path = imgpath> <cfset tmp.filename = listLast(imgpath,"/")> <cfset tmp.fileExtension = right(imgpath,3)> <cfset tmp.filetype = "image"> <cfset arrayAppend(files,tmp)> </cfloop> <cfdump var="#files#"> Thanks, K There are similar functions on CFLib. I believe reGetAll. On Dec 31, 2007 1:01 AM, Adrian Lynch <contact@adrianlynch.co.uk> wrote: ----- Excess quoted text cut - see Original Post for more ----- -- =========================================================================== Raymond Camden, Camden Media Email : ray@camdenfamily.com Blog : www.coldfusionjedi.com AOL IM : cfjedimaster Keep up to date with the community: http://www.coldfusionbloggers.org
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||