Indeed it seems you are trying to accomplish too much with a single regex! But here's another alternative:
s/(?&COMMA)(?:.*?(?:((?&CEEDEE)).*?(?&COMMA)|(?&COMMA)()))(?(DEFINE)(? +<COMMA>,)(?<CEEDEE>cd))/=$+=/;
In reply to Re: greedy subexpression between two nongreedy ones
by Anonymous Monk
in thread greedy subexpression between two nongreedy ones
by raygun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |