I have a string of letters and I am trying to cut them into an array using split(), but I want it to split for multiple letters. I got it to work for an individual letter:
str = "YFFGRDFDRFFRGGGKBBAKBKBBK";
str.split(/(?<=\R)/); //-> Works for only 'R'
Result->[ 'YFFGR', 'DFDR', 'FFR', 'GGGKBBAKBKBBK' ]
What I want:
str = "YFFGRDFDRFFRGGGKBBAKBKBBK";
letters =['R', 'K', 'A'];
// split by any of the three letters (R,K,A)
Result->[ 'YFFGR', 'DFDR', 'FFR', 'GGGK', 'BBA', 'K', 'BK', 'BBK' ];