assuming the source html is dynamically created using a template and
therefore the HTML tag layout shouldn't change...

just find a unique string in the source indicating the start of where you
want to rip content from. Use the find function a few times to get the
beginning and end of positions of the string you want and then use mid to
extract only that string from the source.

Something like (not tested or checked for semantic errors, just a pointer):
<cfset uniqueBegin = find(uniqueStartString,sourceHTML)>
<cfset startHTMLBlock = find(startHTMLString,sourceHTML,uniqueBegin)>
<cfset endHTMLBlock = find(endHTMLString,sourceHTML,startHTMLBlock) +
len(endHTMLBlock)>
<cfset myHTMLBlock =
mid(sourceHTML,startHTMLBlock,endHTMLBlock-startHTMLBlock)>

If you know the source HTML tag layout isn't going to change, just the
content within, then you won't need to do any pattern matching, exact
matching as above will be fine. Inevitably, the source HTML tag layout will
change at some point in the future, so at a minimum stick cfty/cfcatch tags
around the code and notify yourself of problems (using cfmail maybe).

Right, I'm off shopping!


Mark


At 01:27 PM 3/2/01 -0800, Hassan Khawaja wrote:
>Hi Mark,
>
>On the same token, how do I take an entire HTML file
>and only take out the content between say, <table> and
></table>, including the start and end table tags.
>
>Thanks
>Hassan
>
>--- Mark Woods <[EMAIL PROTECTED]> wrote:
>> use REReplace function...
>> 
>> <cfset StringWithoutHTML =
>> REReplace(StringWithHTML,"<[^>]*>","","All")>
>> 
>> you'll find a good intro to regular expressions,
>> including this example, in 
>> the CF 4.0 docs (for some unknown reason, Allaire
>> seem to have removed most 
>> of the regular expression documentation from 4.5).
>> http://www.allaire.com/documents/cf4/dochome.htm
>> 
>> 
>> Mark
>> 
>> 
>> At 03:44 PM 3/1/2001 -0800, you wrote:
>> >Anyone have a good strip HTML format tag?  I need
>> to strip all the HTML out
>> >of a string.
>> >
>> >
>> >- Dave
>> >
>> >Financial Interactive, Inc.
>> >David Meyler
>> >23 Grant Avenue  6th Floor
>> >San Francisco, CA 94108
>> >www.finteractive.com
>> >
>> >Phone : 415.901.2433
>> >Fax:      415.901.2401
>> >
>> >
>> >
>> >
>> >
>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED] with 
'unsubscribe' in the body or visit the list page at www.houseoffusion.com

Reply via email to