Input: "string&number one&two" & "word&number two&three"
.
Desired output: "string number one two" & "word number two three"
.
In other words, the regexp has to match &
only in quoted phrases and remain between them. I managed to do only the following:
(?<=^|\s").*?([&])[^"]+
But there is a non-greedy expression that matches only the first &
in every phrase, if I use a greedy regex, it will match only the last &
in the entire string.
How should I do that? I've really tried a lot of ways and lost my patience.