Need help with ReFind

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>">

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?

Yep. I ended up using False then using mid() along with it to get what I wanted.

You may want to read up on the function a little…

IIRC, using “True” means the function returns a structure of arrays containing the starting positions and lengths of the matched string(s). You can’t <cfoutput> a structure or array. So that’s why you get the complex objects error.

I believe “False” just returns the starting position as a simple number.

Anyway, that’s just off the top of my head. You’d be better off hitting the docs for more accurate info.