Rob, 

Its cool, "\" can be very confusing, especially if you are not just in
ColdFusion. For instance, "\" is a special character in javascript (or Java)
strings. So in CF "\" would be "\\" in Javascript. And "\\" in CF would be
"\\\\" in Javascript. It can be crazy! Its nice that CF doesn't treat "\" as
a special string character cause it makes reading much much easier. 

.......................
Ben Nadel 
www.bennadel.com

-----Original Message-----
From: Rob Wilkerson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 11, 2006 12:13 PM
To: CF-Talk
Subject: Re: Regex Dash

I guess what I'm asking is this: are you actually escaping the "-" or are
you including the backslash in your character set?  I thought it was the
latter, but after testing (yes, I finally got off my lazy ass and tested),
you're correct.  I couldn't remember whether the "\"
behaved as an escape character within a character class.  "\\"
actually includes the "\" in the class.

Sorry for any confusion I may have created.

On 5/11/06, Ben Nadel <[EMAIL PROTECTED]> wrote:
> Rob,
>
> I think you are correct. Putting a "-" in will work also (at least in 
> the Regex Coach program). However, "\-" also works, and it makes me 
> feel more comfortable to know that it is being escaped... But yes, both
will work.
>
> .......................
> Ben Nadel
> www.bennadel.com
>
> -----Original Message-----
> From: Rob Wilkerson [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 11, 2006 11:44 AM
> To: CF-Talk
> Subject: Re: Regex Dash
>
> Just placing the dash at the beginning or end of the character class 
> should be sufficient.  Otherwise the dash is considered a range delimiter.
>
> [-_A-Z] will handle dashes
> [_a-z-] will also handle them
>
> I believe the backslash in a character class is, literally, a 
> backslash in Ben's example and does not affect the dash at all.  I say 
> that without doing an actual test, however.  :-)
>
> Or maybe I misunderstood what you were asking?
>
> On 5/11/06, Ben Nadel <[EMAIL PROTECTED]> wrote:
> > Yeah, since you are not using "\-" in the [] matching group, it 
> > should be replaced out. If you want to keep the "-", add "\-" to the 
> > end of the
> group:
> >
> > REReplaceNoCase(acc_number,"[^a-zA-Z[:space:]'0-9_&:,!()/\-]","","ALL"
> > )
> >
> >
> > .......................
> > Ben Nadel
> > www.bennadel.com
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, May 11, 2006 11:03 AM
> > To: CF-Talk
> > Subject: Regex Dash
> >
> > Is there a remove dash(-) element in this statement?
> >
> > REReplaceNoCase(acc_number,"[^a-zA-Z[:space:]'0-9_&:,!()/]","","ALL"
> > )
> >
> >
> > Lee Surma
> >
> >
> >
> >
> >
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240231
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