Created
January 27, 2015 19:20
-
-
Save zachwills/de33beebdf087a008571 to your computer and use it in GitHub Desktop.
Get array of values within brackets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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