lib/template.js
function replacer(startString, endString){
    var startStringEscaped = startString.escape();
    var endStringEscaped = endString.escape();
    var matchRegexp = new RegExp(startStringEscaped + '([^' +startString[0].escape() + endString[0].escape()+ ']+)' + endStringEscaped,'g');
    
    return function(template, model){
        var brackets = template.match(matchRegexp) || [],
            value;

        for(var i=0;i<brackets.length;i++){
            brackets[i] = brackets[i].replace(startString,'').replace(endString,'');
            value = object.getValue(model, brackets[i].trim()) || '';
            template = template.replace(new RegExp(startStringEscaped + brackets[i] + endStringEscaped,'g'), value);
        }

        return template;
    };
}
function replacer(startString, endString){
    var startStringEscaped = startString.escape();
    var endStringEscaped = endString.escape();
    var matchRegexp = new RegExp(startStringEscaped + '([^' +startString[0].escape() + endString[0].escape()+ ']+)' + endStringEscaped,'g');
    
    return function(template, model){
        var brackets = template.match(matchRegexp) || [],
            value;

        for(var i=0;i<brackets.length;i++){
            brackets[i] = brackets[i].replace(startString,'').replace(endString,'');
            value = object.getValue(model, brackets[i].trim()) || '';
            template = template.replace(new RegExp(startStringEscaped + brackets[i] + endStringEscaped,'g'), value);
        }

        return template;
    };
}
/*
String replacer for replacing variables in plain text, used before implementation of razor view engine