Here's what I've come up with for you. I didn't go through the troubling of
commenting, I figured I'd let you work through all those colons for fun.
This is tested, so it does work. It's certainly not the most efficient
solution, but that wasn't part of your spec. :)

$string =~ s/(?<=\:)([^:]+):/$1\\:/g;

Quoting "Steven W. Orr" <[EMAIL PROTECTED]>:

> I have a string with (possibly) multiple colons in it,
>
> OH: If I was an Osc:ar Mayer Wiener, tha:t is what I:d Truly like to b:e
>
> I am looking for a single regex to turn all subsequent colons into \:
>
> So given the above input I'd like to end up with
>
> OH: If I was an Osc\:ar Mayer Wiener, tha\:t is what I\:d Truly like to
> b\:e
>
> I can do it in two lines but I'd like to see if it can be done with just
> one krafty regex.
>
> Any takers?
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to