Skip to content

Instantly share code, notes, and snippets.

@startswithaj
Last active August 29, 2015 14:02
Show Gist options
  • Save startswithaj/b2424a5e020e4bb11e0b to your computer and use it in GitHub Desktop.
Save startswithaj/b2424a5e020e4bb11e0b to your computer and use it in GitHub Desktop.
Multiple Replace
characters =
'á': 'a'
'é': 'e'
'í': 'i'
'ó': 'o'
'ñ': 'n'
reg = new RegExp '[' + _.keys(x).join("") + ']', 'g'
str.replace reg , (chr) ->
return characters[chr];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment