Rob,

Exactly, no real practical difference here. The only place it becomes
more practical one way or the other is when the situation gets more
complicated. For example, [] is used to group CHARACTERS... But ( | | )
can be used to group SUBSTRINGS ex. (ben is (cool|rad|awesome)) Such a
grouping using [] would be a nightmare.


......................
Ben Nadel
Certified Advanced ColdFusion Developer
www.bennadel.com
 

-----Original Message-----
From: Rob Wilkerson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 27, 2006 3:07 PM
To: CF-Talk
Subject: Re: regexp help

No practical difference.  Ben took the shortcut of using a character set
rather than explicitly stating the "OR" ( | ) condition.

To be clear, though, either of these will remove any _, 1 or 2 from your
value.  So "foo1bar" will become "foobar".  If the chars to be removed
must be at the end of the string you want to use:

<cfset strTest = REReplace( strTest, "_?[12]+$", "", "ALL" ) />

I varied Ben's regex slightly, but the gist is still there.  The key
difference is that the "$" forces the match to appear at the *end* of
the string, not anywhere in the string.

-- 

Rob Wilkerson


On 9/27/06, Ray Champagne <[EMAIL PROTECTED]> wrote:
> Ben, Claude, just so I know, what's the difference between your
solutions?
> Is it merely more than one way to skin a cat, or is one better than
another?
>
> > <cfset strTest = REReplace( strTest, "[_12]+", "", "ALL" ) />
>
>
> > REreplace (MyString, "_|1|2", "", "all")
>
>
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254491
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