Visual studio code - regex - edit multiple line?

Sky scream

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.

Hao Wu

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:

  • Regex
\((\d+) '?(.+?)'? (\d+) (\d+) '?(.+?)'? (\d+) '?(\w+)'?\)
  • Substitution
($1, '$2', $3, $4, '$5', $6, '$7')

Check the test cases

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

is it possible to edit code while debugging in visual studio, like in eclipse (java)

Duplicate line in Visual Studio Code

Default indent line guide in Visual Studio Code?

How to edit all lines in Visual Studio Code

Visual Studio code snippets extra line

Select to End/Beginning of Line in Visual Studio Code

How to match the start of a line using a Visual Studio Code regex?

Visual Studio Code - find and remove entire line

Multiple formatters in Visual Studio Code

Code formatting Visual Studio Code - Line Length

funcList Visual Studio Code regex for custom language

Setting up a snippet in Visual Studio Code with regex

Visual Studio Code Regex contains but not ends with

Visual Studio Code: regex expression starts with but not ends with

How to jump the line of breakpoint in Visual Studio Code?

Line length for C code in Visual Studio Code

Visual Studio Tools for Office Edit multiple files

EDIT: Portable Visual Studio Code

Visual Studio 2013 Ultimate breaking dependencies every code edit

Visual Studio selectively convert multiple lines of code to a single line - ReSharper?

Edit ansible vault file in Visual studio code

Step Back to previous line in visual studio code

where is visual studio code command line?

Visual Studio Code setting delete empty line

Debug Command line in Visual Studio code

How to select and edit multiple word with same text in visual studio 2019?

Cannot edit paste code in visual studio code

Visual Studio Code regex for (not (xx))

How to move cursor to end of each line when editing multiple lines in Visual Studio Code with different line length?