Skip to content

Instantly share code, notes, and snippets.

@tomasgreen
Last active August 29, 2015 14:11
Show Gist options
  • Save tomasgreen/227614de9a65baa42221 to your computer and use it in GitHub Desktop.
Save tomasgreen/227614de9a65baa42221 to your computer and use it in GitHub Desktop.
Detect trailing commas in javascript
We can all agree that trailing commas in IE7 is a drag. The solutions I've found invovles some kind of automatic removal which feels a little over the top. So I've decived to go the easy way.
This regex can be used with the find function in your text editor. So simple and within your control.
,(\n|\s*)+(\s*\/\/.*\n)*\s*[\}\)\]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment