javascript - Js RegExp split every other line -
i'm new @ using regex , can't figure out how this.
i have grouped data separated every other line, so:
liste #1 val 1; val2; val3 liste #2 ...
and output should :
array( "liste #1 val 1; val2; val3", "liste #2 val 1; val2; val3" )
how acheive this?
i split result again, forming structure : array(0 => ['title' =>, 'values' => array()])
assumed require 3 splits.
why use regex, read 2 lines @ time?
var lines = data.split('\n'); (var = 0; < lines.length ; = + 2) { var myarray = []; myarray.push(lines[i]); //this doesn't strip '\n' myarray.push(lines[i+1]); //this doesn't strip '\n' }
Comments
Post a Comment