The backreferences \1 and \2 should only be used inside a regular expression, outside a regular expression you should use $1 and $2 instead so that should be:
s#^((?:[^/\n]|/(?!/))*),((?:\s*|//.*$|/\*(?:[^*]|\*(?!/))*\*/)*\s*[}\] +])#$1$2#mg
In reply to Re: Detecting Dangling Commas in JavaScript
by Anonymous Monk
in thread Detecting Dangling Commas in JavaScript
by wink
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |