Ariful Haque
Ariful Haque

Reputation: 163

removing everything before comma using regex sublime

If I have the following dataset in Sublime, how I can get the following expected output using regex operation.

Given dataset:

1,11111111
123,22222222
12,88888888

Expected output:

11111111
22222222
88888888

So, basically I would like to get rid of everything before comma in the comma itself.

What would be the regex expression to run in sublime?

Upvotes: 2

Views: 4160

Answers (2)

Michał Turczyn
Michał Turczyn

Reputation: 37367

Although you could do it by finding index of last comma and taking substring from your orginal string, which I'd recommend, here isd pattern to use (?<=,).++.

(?=,) - assert that after current position there's comma.

.++ - match as much characters as possible, except new line \n (since you want everything after the comma), unless you are using single line mode in regex.

Demo

Upvotes: 4

Bonlou
Bonlou

Reputation: 472

Doing a ctrl + f, entering \d+,, pressing alt + enter and then return, you should get what you want.

Hope this help.

Upvotes: 3

Related Questions