http://qs321.pair.com?node_id=149594


in reply to Extracting C-Style Comments (Revisited Again)

It took longer than I'd like to admit to figure out the problem this time. :)
| # or double quoted string (?: "[^"\\]* (?:\\.[^"\\]*)*" [^"'/]* )
This matches a double-quoted string, then some amount of code after the double-quoted string. [^"'/]* will match everything up to and including the open parenthesis or equal sign that you are relying on to match as the beginning of the JS regular expression. Simply remove that bit from your regex (after the single-quoted string match as well) and the JS code snippet will be parsed properly.