# Note the lack of 'g' on the second regexp ($str =~ s#:#\\:#g) =~ s#\\:#:#;
Technically, this is two passes, but it can be written on one line. Nick -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steven W. Orr Sent: Tuesday, May 18, 2004 3:56 PM To: malia, sean Cc: boston perl mongers Subject: RE: [Boston.pm] Need a regex :-) On Tuesday, May 18th 2004 at 11:33 -0400, quoth malia, sean: =>( my $str = "OH: If I was an Osc:ar Mayer Wiener, tha:t is what I:d Truly =>like to b:e" ) =~ s/:/\\:/g; => =>That should do it. => =>Let me know if that's what you wanted. Thank you no. I want all of the colons to be transformed *EXCEPT* for the first one. => =>-----Original Message----- =>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] =>On Behalf Of Steven W. Orr =>Sent: Tuesday, May 18, 2004 11:19 AM =>To: boston perl mongers =>Subject: [Boston.pm] Need a regex :-) => => =>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? => => -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Does your driver's license say Organ ..0 Donor?Black holes are where God divided by zero. Listen to me! We are all- 000 individuals! What if this weren't a hypothetical question? steveo at syslang.net _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm