user2467545
user2467545

Reputation:

How to use regular expressions to convert numbers to double quoted string of numbers?

I need to replace all the numbers with double quoted numbers. Below is my String which I have in notepad++ -

test1:{0:1, 1:2, 2:3, 3:4, 4:1, 5:2, 6:3, 7:4, 8:1, 9:2, 10:3, 11:4, 12:1, 13:2, 14:3, 15:4, 17:2, 16:1}
test2:{0:2, 1:3, 2:4, 3:1, 4:3, 5:4, 6:1, 7:2, 8:4, 9:1, 10:2, 11:3, 12:2, 13:3, 14:4, 15:1, 17:4, 16:3}

Is there any way by using regular expressions, I can replace all the numbers with a double quoted string of numbers -

Meaning something like this -

0 will become "0"
1 will become "1"

and same thing with other numbers..

Upvotes: 0

Views: 722

Answers (1)

P0W
P0W

Reputation: 47854

In Notepad++, use Ctrl+H and use :-

Find What : (\d+):(\d+)

Replace with : "\1":"\2"

and click Replace all.

Make sure you have selected "Regular Expression" checkobox for Search Mode

Upvotes: 1

Related Questions