in reply to Replace commas with spaces between quotes, parsing CSV
This requires a "fairly recent" perl, though I'm unsure exactly when s///r was introduced.s/(,)|(".*?")/ $1 || $2 =~ s(,)( )gr /ge;
For older (and for newer) perls, you can use the slightly more verbose:
s/(,)|(".*?")/ $1 || do { (my $s = $2) =~ s(,)( )g; $s } /ge;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replace commas with spaces between quotes, parsing CSV
by kcott (Archbishop) on Apr 17, 2016 at 04:13 UTC |