Is there a function in Java Script that divide a string with several arguments?
var string = "This is a test text, again, this is a testing text";
For example, I can split with ,
by saying string.split(',');
and I will have:
var string = ["This is a test text", "again", "this is a testing text"];
Now, I want to split it with several parameters, so string now would be
var string = ["test text", "testing text"]
I'm looking for a function that extract all the parts that start with test
and end with text
.
replace
some text before splitting?/test(.+)text/g
?