I have some text.
text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
       eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim 
       ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut 
       aliquip ex ea commodo consequat.'
How could I split this up based on the length of another array.
array = 'sed do'
I tried:
alength = array.split(" ").length;
array2 = candidate.match('\/((?:(?:\\S+\\s){'+alength+'})|(?:.+)(?=\\n|$))\/g');
Which returns null.
What I was hoping to get was:
array 2 = 'Lorem ipsum','dolor sit',...'commodo consequat'
Is there another String method I could use maybe?
 
    