function getStatementValue(view, statement){ // vars "@extends('parentview') ", 'extends'
var parentname = "";
view.replace(new RegExp(/\B@\w+\('([^(')\W]+)'\)\s/, 'm'), function(occurance){
parentname = occurance.replace('@' + statement + '(\'', '')
.replace('\')', "");
console.log(parentname) // parentview
console.log(parentname + 'test') // testntview <- unexpected result
});
return parentname;
}
I've got no clue to how that result is appearing.
when I add the string as shown in console.log, it replaces the string from the beginning, almost like it's re-assigning the memory space. Is this supposed to be happening? How do I return the correct parentviewtest result?
parentnamenever changing - i.e.function(occurance)doesn't seem to get called, ever -test... so, it becomesparentview\rtestwhich outputs astestntviewviewargument, I bet there is no "space" at the end of the line, I bet there's a "\r\n" there