Skip to content

Instantly share code, notes, and snippets.

@zachwills
Created January 27, 2015 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachwills/de33beebdf087a008571 to your computer and use it in GitHub Desktop.
Save zachwills/de33beebdf087a008571 to your computer and use it in GitHub Desktop.
Get array of values within brackets
/**
* Get Tokens
* function for extracting tokens
*/
function get_tokens( str ) {
var results = [],
re = /{{([^}]+)}}/g,
text;
while( text = re.exec( str ) ) {
results.push( text[1] );
}
return results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment