Page 1 of 1

Replace repeat word w/another word in a new line

Posted: Thu Oct 27, 2022 10:07 pm
by longsack
I need to replace a repeat word with a word found earlier in the text on each line

EXAMPLE:

('test1', '', '', '', '', '', '', '', '', '', '', '', '', 1, 'test', 'test', 'test', 'test', 'test', '', 1, 0, '');
('test2', '', '', '', '', '', '', '', '', '', '', '', '', 1, 'test', 'test', 'test', 'test', 'test', '', 1, 0, '');
('test3', '', '', '', '', '', '', '', '', '', '', '', '', 1, 'test', 'test', 'test', 'test', 'test', '', 1, 0, '');

EXAMPLE WOULD THEN BECOME THIS:
('test1', '', '', '', '', '', '', '', '', '', '', '', '', 1, 'test1', 'test1', 'test1', 'test1', 'test1', '', 1, 0, '');
('test2', '', '', '', '', '', '', '', '', '', '', '', '', 1, 'test2', 'test2', 'test2', 'test2', 'test2', '', 1, 0, '');
('test3', '', '', '', '', '', '', '', '', '', '', '', '', 1, 'test3', 'test3', 'test3', 'test3', 'test3', '', 1, 0, '');

What would be the regex to make this happen?

Thanks