How to strip off strings after 2nd comma and last comma in each line using regex(i'm using textwrangler in mac)

46 Views Asked by At

I have this set of strings in which I have to remove 3rd string in quotes and 6th in quotes. Thanks in advance.

Given Strings:

('Holtsville', 'NY', '00501', '40.8152', '-73.0455', 'Suffolk');
('Holtsville', 'NY', '00544', '40.8152', '-73.0455', 'Suffolk');
('Adjuntas', 'PR', '00601', '18.1788', '-66.7516', 'Adjuntas');
('Aguada', 'PR', '00602', '18.381389', '-67.188611', 'Aguada');
('Aguadilla', 'PR', '00603', '18.4554', '-67.1308', 'Aguadilla');

Expected Result:

('Holtsville', 'NY', '40.8152', '-73.0455');
('Holtsville', 'NY', '40.8152', '-73.0455');
('Adjuntas', 'PR',  '18.1788', '-66.7516');
('Aguada', 'PR', '18.381389', '-67.188611');
('Aguadilla', 'PR', '18.4554', '-67.1308');
0

There are 0 best solutions below