Character classes and negated character classes [], [^] often change the
meaning of what the contents mean. While not an expert, I have learned that
character classes are for one character at a time. I think what Howard Owens
suggested in the previous response suggests a good work around:

<cfset inStart=FindNoCase("<!-- snip -->", scope.infile, 1)>
<cfset inEnd=FindNoCase("<!-- /snip -->", scope.infile, 1)>
<cfset outContent=Mid(scope.infile, inStart, inEnd-inStart)>

<cfoutput>
#outContent#
</cfoutput>

Furthermore, if you combined this type of search with a variable to keep
track of where you have already searched (in place of the 1), you could
convert this to a loop that would search globally for all instances.

-----Original Message-----
From: Oblio Leitch [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 01, 2000 1:13 PM
To: [EMAIL PROTECTED]
Subject: RE: Regular Expressions


Can you confirm that you can only exclude single characters and not whole 
strings?  I would think you should be able to set a string using 
parentheses, but when I do, the parentheses lose their "special character" 
status.  Is there any way to regain it or recreate it?

Oblio

At 5/1/00 09:51 AM, you wrote:
>I've been reading O'Reilly's "Mastering Regular Expressions" (haven't quite
>finished) and to my understanding using [^] is only for single characters.
>Using ^ outside a character class (meaning the [] format) means "match the
>start of a line." If you can be reasonably certain, by having a familiarity
>with your data, that your inside sting will not include a "<", you will be
>able to use:
>
>REFind("<!-- snip -->[^<]<!-- /snip -->", file)
>
>but again, if there are any <'s between those snips you'll have to find
>another way. Maybe when I finish the book I'll know a good way to figure
>this sort of thing out.
>
>Danny Zigrino
>[EMAIL PROTECTED]
>
>-----Original Message-----
>From: Jonathan McGuire [mailto:[EMAIL PROTECTED]]
>Sent: Monday, May 01, 2000 9:42 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Regular Expressions
>
>
>Try this (untested, but should be darn close):
>REFind("<!-- snip -->^(<!-- /snip -->)<!-- /snip -->", file)
>
>In the first one you tried, must realize that regexp are by default
>"hungry".  They will match on the largest match possible.  In your case
this
>meant that the regexp was matching the first opening tag all the way to the
>last closing tage due to the ".*".
>
>In your second one you were much closer but "[^<!-- /snip -->]" means to
>match any of the following: not "<" or ! or - or / or s or n, etc.
>
>Try it with parens as above to say "not this pattern".
>
>Jonathan McGuire
>
>----- Original Message -----
>From: "Oblio Leitch" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Sunday, April 30, 2000 4:02 PM
>Subject: Regular Expressions
>
>
>I'm having trouble and I was hoping someone can help me.
>
>Senario: I have a page that I'm trying to extract pieces from. To mark the
>section I'm trying to edit, I've place <!-- snip --> and <!-- /snip -->
>around the section. Next, I'm opening the file (CFFILE) and doing a regular
>expression to find that section: REFindNoCase("<!-- snip
>-->.*<!-- /snip -->", file). Works great. Now, to make several places on
>the page editable, I placed several snips. Now the regular expression
>only finds the first open snip and the last close snip, including all the
>others inside.
>
>Question: How do I find just those sections? I thought about doing
>REFindNoCase("<!-- snip -->[^<!-- /snip -->]*", file), but that doesn't
>work - it excludes all the characters instead of the whole string. Is there
>a way to exclude a complete string instead of just a group of
>characters?
>
>Any suggestions would be most helpful. Any example would be great too.
>
>---------------------------------------------------------------------------
-
>--
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>
>
>---------------------------------------------------------------------------
-
>--
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>---------------------------------------------------------------------------
---
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or 
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in 
>the body.

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to