141
rated 0 times
[
147]
[
6]
/ answers: 1 / hits: 16450
/ 8 Years ago, fri, february 26, 2016, 12:00:00
If I have a string like this:
var str = play the Ukulele in Lebanon. play the Guitar in Lebanon.;
I want to get the strings between each of the substrings play and in, so basically an array with the Ukelele and the Guitar.
Right now I'm doing:
var test = str.match(play(.*)in);
But that's returning the string between the first play and last in, so I get the Ukulele in Lebanon. Play the Guitar instead of 2 separate strings. Does anyone know how to globally search a string for all occurrences of a substring between a starting and ending string?
More From » regex