in reply to Is there a way I can substitute for ":" except when it is preceded by a letter C
Or if the phrase "negative lookbehind assertion" fills you with dread ...
my $string = 'Engine4.2.0.5:prefix=PDE:path=C:\h\COE\COMP\PDE:status=installed:vers +ionNumber=4.2.0.5:type=SOFTWARE-COE:'; $string =~ s/([^C]):/$1'/g;
...will do it too.
Update: ...almost:( See Tachon's post below for how to do it properly {sigh}.
It reads; capture any single non-"C" char followed by a ":" and replace both by the captured char ($1) and the "'".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Is there a way I can substitute for ":" except when it is preceded by a letter C
by tachyon (Chancellor) on Aug 17, 2002 at 01:19 UTC | |
by MrNobo1024 (Hermit) on Aug 17, 2002 at 02:35 UTC |