regex to remove comma between double quotes notepad++

Try the following

import re

print re.sub(',(?=[^"]*"[^"]*(?:"[^"]*"[^"]*)*$)',"",string)

This will remove comma between quotes


mrki, this will do what you want (tested in N++):

Search: ("[^",]+),([^"]+")

Replace: $1$2 or \1\2

How does this work? The first parentheses capture the beginning of the string up to (but not including) the comma into Group 1. The second parentheses capture the end of the string after the comma into Group 2. The replacement substitutes the string with a concatenation of Group 1 and Group 2.

In more detail: in the first parentheses, we match the opening double quotes then any number of characters that are not a comma. That is the meaning of [^,]+. In the second parentheses, we match any number of characters that are not a double quote with [^"]+, then the closing double quotes .


Just an update to @zx81's brilliant solution. Lets say you have 2commas between quotes

Then the regex search has to be modified as follows:

("[^",]+),([^",]+),([^"]+")

Replace needs to be modified as

$1$2$3

So on modify it depending on the # of commas.

I tried exploring to see if recursive regex was possible but the does not seem to be possible as of now