Rodney,
You're regex is accurate. You just need to use it in this format.
result = mystring.ReplaceAll("(?m)^(.{6})08", "$142");
I assume REReplace is getting confused on the numerics.
Fro
-----Original Message-----
From: Rodney Chang [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 08, 2008 6:46 PM
To: CF-Talk
Subject: Re: Can Regex find and replace the 7th and 8th character of a
line.
So the 7th and 8th characters are 0 and 8, and you want to replace that
with
4 and 2?
REReplace(mystring, "(?m)^(.{6})08","\1 42","ALL")
This is the closest I can get except I can't get CF to treat "\142" as
backreference 1 & "42". A workaround would to call ReReplace twice:
result = REReplace(mystring, "(?m)^(.{6})08","\1xBUGx","ALL");
result = REReplace(result, "(?m)xBUGx","42","ALL");
Maybe some regex god can find a better solution without having to make
the
duplicate REReplace() call.
Rodney
On Tue, Apr 8, 2008 at 2:25 PM, Ian Skinner <[EMAIL PROTECTED]> wrote:
> I need to loop over a file with a few 10's of thousands of lines and
> replace the 7th and 8th characters{08} with two other characters {42}
in
> each and every line.
>
> Is there some slick way to do this with regex or some other mechanism?
>
> Or do I just loop over the file, chop each line into several pieces
and
> concatenate it back together with the proper values in the proper
places?
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:303368
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4