in reply to Replace only selected characters
You describe replacing only the first comma, but then expect exactly the opposite: "ABC,XYZ PERL IS AWESOME INNIT". It seems you want to remove all commas except for the first.
Try this. It "looks behind" for a comma, without consuming it; then matches (and stores) up to a comma; then replaces; and repeats.
s/(?<=,)([^,]*),/\1/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replace only selected characters
by rohanan (Novice) on Oct 14, 2011 at 18:58 UTC | |
|
Re^2: Replace only selected characters
by rohanan (Novice) on Oct 14, 2011 at 21:41 UTC | |
by AnomalousMonk (Archbishop) on Oct 16, 2011 at 02:08 UTC | |
by Anonymous Monk on Oct 14, 2011 at 23:23 UTC |