JSFiddle - React, Tailwind, and code Playground
JavaScript
var needle = "begin:";
var haystack = "begin: This is a story all about how my life got flipped turned upside down";
var phrase = haystack.substring( haystack.indexOf(needle) + needle.length).trim();
document.body.innerHTML = phrase;
var needle = "all";
var beforePhrase = haystack.substring(0,haystack.indexOf(needle) - 1);
document.body.innerHTML = beforePhrase;