Cedric Villat wrote:

> I get an error though, as it complains about the ?. What are they for?

It's a (mistyped :) Perl extension that POSIX (and CF) don't support: 
'?:' after the '(' stops the parenthesised section being treated as a 
referenceable subexpression: it's just used for grouping.

It's *possible* that a CF-compatible solution could be engineered like 
that, but without the '?'s you would have to work out what numbered 
backreferences your prefix and suffix ended up being... Always assuming 
that CF would assign the same numbers in all circumstances, which it 
wouldn't.

[ponders]

You *might* get away with:

  rereplace(text,"((.)\.([^0-9]))|(([^0-9])\.(.))", "\2\5 \3\6", "all");

if the subexpressions are numbered sanely and CF treats ones that aren't 
assigned as empty strings (I haven't tried it). Even if that worked, 
you'd still not get repeated periods treated correctly though.

There are a number of Perl RE extensions I *really* miss in CF - that's 
one of them, but lazy matching is the big one (ie. take the first, as 
opposed to the longest, match for an RE fragment). Lookahead and 
lookbehind assertions are nice too, and would provide another potential 
solution to your problem.

-- 
Pete Jordan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:195774
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