tags:

views:

40

answers:

3

I need to do a find and replace in Notepad++ of

Err.Number, canBeAnything, canBeAnything, Err.Description

(where canBeAnything is just what it says)
with

Err.Number, "canBeAnything", "canBeAnything", Err.Description

(basically, put quotes around canBeAnything)
I got as far as the find

Err.Number, .+, .+, Err.Description

But I'm stuck on the replace. Any suggestions?

+1  A: 

You need to add groups to your regex:

Err.Number, (.+), (.+), Err.Description

and then reference then my location in your replace:

replace with

Err.Number, "\1", "\2", Err.Description

JacobM
Thank you SO much!
dmr
+1  A: 

Your match is doing more work than it needs to.

Err.Number,([^,]+),([^,]+),Err.Description 

This matches "Err.Number", a comma, anything that's not a comma up to.., a comma, anything that's not a comma up to.., a comma, and "Err.Description".

clintp
+1  A: 

May be you should use non-greedy qualifiers:

Err.Number, .+?, .+?, Err.Description
Dmitry