I'm trying to dynamically replace a sub string in a parent string. I've tried string.replace('old','new') to no avail.
Here's the snippet giving me trouble.
newbuffer.replace( matches[i], p.shortcodes[x].vala );
console.log( "Replace " + matches[i] + " with " + p.shortcodes[x].vala );
Result is
"Replace [hello] with <span class="strong"><p>Awaiting ajax request...</p></span">"
Am I missing something here? Does .replace take "plain text" or will I need to do some regex?