in reply to Is there a way I can substitute for ":" except when it is preceded by a letter C
A negative look behind asserion will do the trick, see perlman:perlre on lookahead and look behind assertions both positive and negative for more details.
You could just use 'C' instead of the character class [cC] which makes this case insensitive. Of course you could also use /i at the end to do this but the character class was included in case you want to skip stuff like D:....$_ = 'c:--->j:a:p:h:,:'; s/(?<![cC]):/!/g; print;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|