title: Parsing string, into multiple arrays, into dynamic dropdown
body: <p>I have stored a dynamically created object as a string in a database because I lack knowledge of better choices and at this point I think there is no going back. I am trying to parse this is in a way so the user can not break it somehow.</p>
  
  <p>I output a string that is in format</p>
  
  <pre><code>    |attr1|,subA,subB,subNth,~,|attrNth|,sub2A,sub2B,sub2C,sub2D,~
  </code></pre>
  
  <p><strong> 1st </strong> then split it by doing</p>
  
  <pre><code>    supertest = option.split("~");
  </code></pre>
  
  <p>Leaving me with</p>
  
  <pre><code>    |attr1|,subA,subB,subNth,,,|attrNth|,sub2A,sub2B,sub2C,sub2D,,
  </code></pre>
  
  <p><strong>2nd</strong> I loop through find my pipe symbols, and split again</p>
  
  <pre><code>   for(n=0; n&lt;supertest.length; n++) {
  
          var start_pos = supertest[n].indexOf('|') + 1;
          var end_pos = supertest[n].indexOf('|',start_pos);
          var optionParsed = supertest[n].substring(start_pos,end_pos);
          test = supertest[n].split("|").pop();
  
          choiceArray = test.split(",");
          }
  </code></pre>
  
  <p>Leaving me with 3 arrays with dynamically created names(I only want two)</p>
  
  <pre><code> array1- ,subA,subB,subNth,
   array2- ,sub2A,sub2B,sub2C,sub2D,
   array3- blank or null or undefined?
  </code></pre>
  
  <p><strong> JSFIDDLE: </strong> <a href="http://jsfiddle.net/SteveRobertson/4YHSr/21/" rel="nofollow">http://jsfiddle.net/SteveRobertson/4YHSr/21/</a>  </p>
  
  <p>I am ultimately trying to create dynamic select input lists with "attr"'s as labels and "subNths" as options. so I tried to create a jsfiddle to make it easier, because i now realize this is a bigger question than i initially thought, but for some reason after the three select drop down lists are done loading everything disappears. I tried. If anyone can 
  help me I would appreciate it. What I ideally want to know is how can i get my individual arrays to be in the format </p>
  
  <pre><code>attr1 = [subA, subB, subNth]
  </code></pre>
  
  <p>Thank you for anyone who thinks they might know this and can help</p>