Split using RegEx in JavaScript
Say I have a generic line
"...&<constant_word>+<random_words_with_random_length>&...&...&..." I would like to split the string using
"<constant_word>+<random_words_with_random_length>&" for which I tried to split RegEx, for example
<string>.split(/<constant_word>.*&/) This RegEx breaks up to the last '&' unfortunately, i.e.
"<constant_word>+<random_words_with_random_length>&...&...&" What would RegEx code be if I wanted it to split when it got the first "&"?
example for line splitting e.g.
"example&ABC56748393&this&is&a&sample&string".split(/ABC.*&/) gives me
["example&","string"] while I want ...
["example&","this&is&a&sample&string"]