I want to replace all occurrences of && with and.
For example, x&& && && should become x&& and and.
I tried re.sub(' && ', ' and ', 'x&& && && '), but it didn't work, the first && already consumed the whitespace so the second one didn't match.
Then I thought of non-capturing group and tried but failed again.
How can I solve this problem?