Here's one approach:
<!--- Comments with fields --->
<cfset regexComment = "<!---(.*?)--->">
<cfset regexCommentFields = "^(.*?):(.*)$">
<cfset fileContent = "blah blah<!--- Sample Comment --->ya ya
<!---
Widget Name: My Widget
Widget URL: http://siriusinnovations.com
Description: This is the description
Version: 2.0
Author: Philip Hayes
Author URL: http://siriusinnovations.com
--->
<!--- Sample Comment 2 --->">
<cfset contentPosition = 1>
<dl>
<cfloop condition="contentPosition GT 0">
    <cfset commentSubs = reFind(regexComment, fileContent, contentPosition,
true)>
    <cfset contentPosition = commentSubs.pos[1] + commentSubs.len[1]>
    <cfif arrayLen(commentSubs.pos) EQ 2>
        <cfset commentContent = mid(fileContent, commentSubs.pos[2],
commentSubs.len[2])>
        <cfloop list="#commentContent#" delimiters="#chr(13)##chr(10)#"
index="commentLine">
            <cfif reFind(regexCommentFields, commentLine) GT 0>
                <cfoutput><dt>#trim(reReplace(commentLine,
regexCommentFields, "\1"))#</dt><dd>#trim(reReplace(commentLine,
regexCommentFields, "\2"))#</dd></cfoutput>
            </cfif>
        </cfloop>
    </cfif>
</cfloop>
</dl>

On Jan 23, 2008 10:52 AM, Philip Hayes <[EMAIL PROTECTED]>
wrote:

> I need some help with an area of ColdFusion which I would call my
> Achilles Heal of ColdFusion Programming.  I cannot get my mind around
> Regular Expressions, but know its the solution to many of my
> problems.  For example
>
> I have the following CF Comment on a cfm page:
>
> <!---
> Widget Name: My Widget
> Widget URL: http://siriusinnovations.com
> Description: This is the description
> Version: 2.0
> Author: Philip Hayes
> Author URL: http://siriusinnovations.com
> --->
>
>  I want to perform a read on the CFM file using CFFILE.  I then want
> to use a find/replace with regular expressions to find the values for:
>
> Widget Name
> Widget URL
> Description
> Version
> Author
> Author URL
>
> Is there anybody out there who can help me do this?  I know is
> probably pretty easy but i just don't get regular expressions.
>
> Thanks.
>
> Phil
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297217
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to