There is a string:
var str = "a1c a12c a23c ac 1234 abc";
and a RegExp:
var re = /a(\d*)c/g;
I want to split str by number that between a and c, the result I want is:
['a','c a','c a','c a','c 1234 abc']
how to do it?
You could use a positive look ahead.
var str = "a1c a12c a23c ac 1234 abc";
console.log(str.split(/\d*(?=\d*c.*a)/));
str = "b1c a12c a23c ac 1234 abc", the result is wrong.['b1c a','c a','c a','c 1234 abc'], in fact, reslut is ['b','c a','c a','c a','c 1234 abc']b1c a got parse to "b", "c a"?
['a','c a','c a','c ac 1234 abc']? I want result is['a','c a','c a','c a','c 1234 abc']. I want to splitactoo.