The question marks in this instance are instructions to not create a 
backreference for that set of parens.  You can drop them, but you might 
have to adjust which backreferences you use in the replace param.

Now that you mention it, you're right:  this will fail on
www.a.com
but not
www.aa.com
since the first a is "used up" by the regex the first time through.  You 
may be able to get around this using lookahead.  I don't remember the 
syntax off the top of my head (it's been a busy Monday) but if I get a 
chance later today, I'll try to look it up.

--Ben

Cedric Villat wrote:
> Ben,
> 
> That makes sense. I get an error though, as it complains about the ?. What 
> are they for? I thought the ? was the "0 or 1 occurances" operator.
> 
> Also, would this cover things like:
> 
> 12.2.12.12 ?
> 
> I noticed that my current regex of
> m = REReplace(m, "([0-9])\.([0-9])", "\1|\2", "ALL");
> 
> generate 12|2.12|12. I assume this is because the pointer after the first 
> replace has passed the single "2". Is there a way around that too?
> 
> Thanks!
> Cedric
> 
> 
>>Assuming CFMX:
>>
>>rereplace(text,"(?(.)\.([^0-9]))|(?([^0-9])\.(.))", "\1\2", "all");


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195769
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to