I want to use visual studio code regex to introduce commas and single quote at different point of a line. Can you help please? I want to transform
(1 ant 18 0 test abacus123 789 pass),
(2 dog 26 67 exp b+45 456 fail),
(3 tiger 5 2 'reg e-t' 126 fail),
To
(1, 'ant', 18, 0, 'test abacus123', 789, 'pass'),
(2, 'dog', 26, 67, 'exp b+45', 456, 'fail'),
(3, 'tiger', 5, 2, 'reg e-t', 126, 'fail'),
There are so many lines of data that i have to transform like this, not sure how to do it.
Any help is much appreciated.
You need to provide more examples or describe the rules better.
According to the examples you have provided so far, you may try the following regex:
\((\d+) '?(.+?)'? (\d+) (\d+) '?(.+?)'? (\d+) '?(\w+)'?\)
($1, '$2', $3, $4, '$5', $6, '$7')
Check the test cases
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments