in reply to Detecting Dangling Commas in JavaScript
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Detecting Dangling Commas in JavaScript
by wink (Scribe) on Oct 27, 2010 at 19:14 UTC |