get string between two characters js code example
Example 1: javascript get string between two characters
const oldString = 'John1Doe2'
const stringBetweenCharacters = oldString.match(/1(.*?)2/i)[1] //Doe
Example 2: javascript get text between two words
//Gets the part of the string inbetween the : and the ;
var part = str.substring(
str.lastIndexOf(":") + 1,
str.lastIndexOf(";")
);