What I’m trying to do with this code is to get all text after the “phraseToFind” from this really long string, but it just logs something completely different. In fact regardless of whatever I put in phraseToFind it just gives something unexpected.
Sorry character limit was exceeded had to put it in a pastebin. Sorry for the inconvenience.
Code with the long string:
https://pastebin.com/gzqh08MS
Rest of the code :
const phraseToFind = "metadataText ":null,"text ":{"textDirection ":"FIRST_STRONG ","text ":"";
const startIndex = x.indexOf(phraseToFind);
if (startIndex !== -1) {
const result = x.slice(startIndex + phraseToFind.length);
console.log(result);
}