const text = 'My cow always gives milk' const start = `cow`; const end = `milk`; const middleText = text.split(start)[1].split(end)[0] console.log(middleText) // prints "always gives"