The easiest way to do something like this is to use reReplace rather than reFind.

If you're using CFMX you can do this:

<cfsavecontent variable="str">
<cfoutput>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
   <title>Untitled</title>
</head>

<body>
<h1>Some text</h1>


</body> </html> </cfoutput> </cfsavecontent>

<cfset innerStr = reReplaceNoCase(str,'(.*<h1.*?>)(.*?)(</h1>.*)','\2','all')>

<cfoutput>#innerStr#</cfoutput>

If you're on a previous version of CF it will be a bit more tricky because prior to CFMX you couldn't tell regexes not to be greedy.

Spike

Mark M wrote:

hey all -

I'm trying to grab the value of the what is between the <h1></h1> tags,

and this is what I came up with:

--
str = ReFind("(<h1>|<H1>)[^(</h1>|</H1>)]+(</h1>|</H1>)", html, 1, true);
if(str.len[1] neq 0)
{
title = mid(form.help, str.pos[1], str.len[1]);
title = replaceNoCase(title, "<h1>", "");
title = replaceNoCase(title, "</h1>", "");
}
--


(a) is there a better solution without having to replace?
(b) This fails whenever there is a 'h' in the #html#, and I can't work out why.

TIA.

Mark
-----------------------------------
[EMAIL PROTECTED] ICQ: 3094740
Safe From Bees
[www.safefrombees.com]


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/





-- Stephen Milligan Consultant for hire http://www.spike.org.uk



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to