I have a collection of CFM pages from which I need to extract the H1 text. I’m using a combination of cfdirectory, cffile, and refind. The refind step is what seems to be boogering me up.
This is what I have:
<cfdirectory directory="#expandpath("./")#" name="listfiles" filter="*.cfm">
<cfoutput query="listfiles"><cffile action="read" file="#expandpath("./")##name#" variable="result">
<cfset regex = "<div [^>]*><h1>(.+?)</h1>">
#refind(regex,result,10,"True")#
</cfoutput>
This gives me the following error:
Complex object types cannot be converted to simple values.
If I change the “True” in the Refind to “False” I get a series of numbers that I think are the positions that a match is found.
Any ideas what I’m doing wrong?