Not sure on the best way to go about this...
Here's an example of what I want to do.
jscript code:
// a "dynamic" object - identifiers will vary by function
var some_variables =
{
foo: "some text",
bar: "some more text"
};
// user input - can contain such variables when surrounded with "%"
var input = "I am writing %var:foo% here.";
var regex = /%var:([a-z]+?)%/gi;
var output = input.replace(regex, some_variables[regex.$1]);
...but I just get undefined from the RegExp. Is there a way of doing this?