disclaimer:  I'm a total n00b with regex too.  i've only spent 4 minutes
with Ben's 10 minute book so far... so if there may be a better way to do
this (and if there is, I'm sure somebody will speak up)...but this works:

<cfset testcase ="d 307,569|d307,558|d 221,145|">
<cfset testcase = ReReplace(trim(testcase),"([Dd]\s?)","D","all")>

the problem that I think I see with yours is that you put both the dD and
the space within character classes, which only match a single character.  By
taking the space (\s) out of the character class, you're saying, "one upper
or lower 'D' optionally followed by a space (the optional flag being the
'?').

charlie

----- Original Message -----
From: "Nathan C. Smith" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, April 09, 2004 8:33 AM
Subject: Regex newbie has partial success

> I am trying to go through a string and replace instances of "D", that may
or
> may not have spaces after them, with uppercase "D" adjacent to the
following
> numbers.
>
> <cfset testcase ="d 307,569|d307,558|d 221,145|">
>
> <cfset testcase = ReReplace(trim(testcase),"[dD][\s]?","D")>
>
> If anyone looking at this has a pointer or can nudge me towards the field
of
> regex study to complete my task I would appreciate it.  I have Ben's new
> book in front of me, but clearly I am missing something.
>
> Thank you much.
>
> -Nate
>
> Nathan Smith  McKee, Voorhees & Sease, P.L.C.  515.288.3667
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to