Use non-greedy search in template matching
This commit is contained in:
parent
97d9857505
commit
82f5e6ffd5
@ -240,7 +240,8 @@ class {
|
|||||||
|
|
||||||
static parseTemplate(text, error) {
|
static parseTemplate(text, error) {
|
||||||
if(typeof(text) !== "string") return text;
|
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));
|
text = text.replace(RE_template, (str, p1, offset, s) => this.parseTemplateString(p1));
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user