I am currently faced with the challenge of splitting a string based on capital letters. Here is the code I have come up with:
let s = 'OzievRQ7O37SB5qG3eLB';
var res = s.split(/(?=[A-Z])/)
console.log(res);
However, there is an additional requirement that complicates things. If the capital letters are continuous, the regex should continue "eating" until the sequence ends. In the provided example, it returns:
..R,Q7,O37,S,B5q,G3e,L,B
The desired result should actually be:
RQ7,O37,SB5q,G3e,LB
Any thoughts or suggestions would be greatly appreciated. Thank you.