JSFiddle - React, Tailwind, and code Playground

by astex

JavaScript

var find_string_between = function(str,a,b) {
    var r = new RegExp(a + ' .*' + b + ' ', 'g'),
        res = str.match(r);
    return res;
}

$(document).append(find_string_between('A sentence lies within another sentence lies within another.', 'A', 'within'));