Find and replace with
^.*?\["
Input
alpha = ["first", 55, 28]
beta = ["second", 89, 09]
gamma = ["third", 99, 40]
Result
first", 55, 28]
second", 89, 09]
third", 99, 40]
The problem with ^.*?" is that it's replacing all the content one by one
You're starting with this content
alpha = ["first", 55, 28]
beta = ["second", 89, 09]
gamma = ["third", 99, 40]
After first replace (as expected), the content becomes this,
first", 55, 28]
beta = ["second", 89, 09]
gamma = ["third", 99, 40]
Now, in the next replace, the cursor is still at the start of the line. Notice that there is one more double quote " in this line (just after the text first), thus the RegEx is matched again and so it will again replace everything before
the first double quote
, 55, 28]
beta = ["second", 89, 09]
gamma = ["third", 99, 40]
When you continue in this manner, you'll get the output as:
, 55, 28]
, 89, 09]
, 99, 40]
And so use ^.*?\[" instead of ^.*?"
EDIT
If there are any chances that you have arrays inside your parent array, then you can use ^.*?\=\s*\[\s*".
This regex will also deal with whitespace character.
Input
alpha = ["first", 55, 28]
beta = ["second", 89, 09]
gamma = ["third", 99, 40]
delta = ["fourth", ["55"], 28]
After replace
first", 55, 28]
second", 89, 09]
third", 99, 40]
fourth", ["55"], 28]
^[^"]*"..^.*?"withX(ie something) it works as expected, but if you replace with blank, it doesn't work. I suspect there's a bug where the match pointer is incorrectly set after replacing with blank.