jsg
jsg

Reputation: 1264

Visual Studio Code using Regular expression to replace text with new line

Hi I got about a 1000 lines of data, what I need to do is using regular expression mode on visual code to find "),(" and replace with a new line after the comment. Is this possible, below is an example of what im trying to achieve.

(test, null, null, 1),(test1, null, null, 2)

into

(test, null, null, 1),
(test1, null, null, 2)

Upvotes: 2

Views: 5302

Answers (1)

Adrian Dymorz
Adrian Dymorz

Reputation: 967

Search:

\([^\)]*\),

\(, \) and , are literals

[^\)]* matches all characters which are not an )

Replace:

$0\n

$0 is the back reference for the whole match

$x (e.g. $1) would be the back reference for a group marked by ( and ), but is not required here as kennytm pointed out

\n is a newline

Upvotes: 6

Related Questions