in reply to matching two or more characters and substituting
Direct answer:
s/[",]//g
But that's a poor solution. Splitting and dequoting are two separate operations which work on different inputs. It doesn't make much sense to combine them. A better solution:
#!/usr/bin/perl use strict; use warnings; my $string = 'Apropovir,"Atripla(tenofovir+emtricitabine+ efavirenz)", +'; my @tokens = split(/,/, $string); s/^"//, s/"$// for @tokens; for my $token (@tokens) { print "$token\n"; }
But the splitting is still problematic. What if there's a comma in the quotes? You should be using Text::CSV_XS.
|
|---|