I am trying to find all values between {{ and }} that start with a $ followed by [\w.]+ but doesn't start with a number. This works in getting the value, however, it only gets the last item. What I am looking for, is a list of these items, so in this example I would like my array to contain (based off the example):
['{{I\'m $name and I am $age years old}}', '$name', '$age']
When executed, $name is not included in this array as seen here:
let result = '$welcome: {{I\'m $name and I am $age years old}}'.match(/\{\{.*(\$(?!\d|\.)[\w.]+).*\}\}/)
console.log(result)
\$[.\w]+(?=[^{}]*}). Or match that block first then run another regex on it.