Regex for mustache-style double braces?
javascript, regex
Solution
If you use a global search with `.match`, JavaScript won't give the capture groups in its array output. As such, you need to do it twice: Once to find the `{{...}}` pairs, then again to extract the names from within them:
str.match(/{{\s*[\w\.]+\s*}}/g)
.map(function(x) { return x.match(/[\w\.]+/)[0]; });
Problem
I'm using Mustache-style tags inside of AngularJS. What's the best regex to use to return an array of just the text inside the mustache braces? Sample data: ``` "This could {{be }} a {{ string.with.dots_and_underscores }} of {{ mustache_style}} words which {{could}} be pulled." ``` Expected output: ``` ['be','string.with.dots_and_underscores','mustache_style','could'] ```