Oops!  A slight mistake in there.

reReplaceNoCase(content,".*#fieldName#:[[:space:]]+([^[:space:]]+)($|[[:space:]]+.*)","\1")

Some notes:

[[:space:]] represents spaces, tabs, various end-of-line characters (10 
and 13 for sure), etc.  Basically anything that's whitespace.

In a character class (something in square brackets) if the first 
character is a carat, it means "not the rest of this stuff".  So 
[^[:space:]] means "not whitespace".

Parens do several things.  One is grouping choices.  ($|bob) at the end 
of a regex means "the end of the string" (since that's what a $ means) 
or the literal text "bob".  Parens also tell the engine to "remember" 
some text by placing it in a backreference.  "\1" is a backreference. 
It's the first backreference.  Basically, it's the first set of parens 
in the regex.

Um.  That should basically cover your questions.  HTH.  If you have 
more, feel free to ask them.

--Ben

Burns, John D wrote:
> This is returning nothing now.  I'm trying to understand what's going on
> so I can tweak some myself, but I just keep confusing myself.  What does
> the "\1" mean?  And you're saying the space class will handle end of
> lines right?
> 
> John 
> 
> -----Original Message-----
> From: Jerry Johnson [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, October 21, 2004 2:27 PM
> To: CF-Talk
> Subject: RE: RegEx help
> 
> Both!
> 
> You should probably replace the second and third "spaces" with the
> generic space "class". This will allow tabs, returns, and spaces.
> [[:space:]]
> 
> The last character issue I didn't handle at all.
> 
> Maybe something along these lines (completely not tested)
> 
> <cfset fieldName="FirstName">
> <cfset
> fieldVal=rereplaceNoCase(content,".*#fieldName#:[[:space:]]+([^[[:space:
> ]]]+)($|[[:space:]]+.*)","\1")>
> 
> This should check for one or more space characters or the end of the
> string.
> 
> Jerry Johnson
> 
> 
>>>>[EMAIL PROTECTED] 10/21/04 02:15PM >>>
> 
> Maybe that's what it is.  I think the case I'm talking about has a
> linebreak after the data.  Which space (chr(32)) would I replace with
> the space class?  The one after the ^ or the one before the +.
> 
> John 
> 
> 
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=38

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182251
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to