Use non-greedy search in template matching

This commit is contained in:
Thomas Lovén 2019-02-16 14:17:28 +01:00
parent 97d9857505
commit 82f5e6ffd5

View File

@ -240,7 +240,8 @@ class {
static parseTemplate(text, error) {
if(typeof(text) !== "string") return text;
var RE_template = /\[\[\s(.*)\s\]\]/g;
// Note: .*? is javascript regex syntax for NON-greedy matching
var RE_template = /\[\[\s(.*?)\s\]\]/g;
text = text.replace(RE_template, (str, p1, offset, s) => this.parseTemplateString(p1));
return text;
}