title: Need code for seperating the part of string(latex code) into an object : like below -->
body: <p>I have the <em>latex code</em> in the <strong>string</strong> and want output as a <strong>object</strong></p>
  <pre><code>const str = `
  i am line1
  i am part1 
  i am some1
  
  i am line2
  i am part2
  i am some2
  
  i am line3
  i am part3 
  i am some3
  `;
  
  const output = [
      {
          line: &quot;i am line1&quot;,
          part: &quot;i am part1&quot;,
          some: &quot;i am some1&quot;
      },
      {
          line: &quot;i am line2&quot;,
          part: &quot;i am part2&quot;,
          some: &quot;i am some2&quot;
      },
      {
          line: &quot;i am line3&quot;,
          part: &quot;i am part3&quot;,
          some: &quot;i am some3&quot;
      }
  ]
  
  </code></pre>
  <p>I am not a full time javascript developer, am very beginner at it just got it in between by high school project so want to get the object someway, tried some other loops  and splitting which i am not good at currently, please help with some code ! Thanks</p>
  <p>edit: i have string something like below</p>
  <pre><code>const string = ` 
  1. Inner surface of a ....
  
  ![](something . com) 
  
  A) 1
  B) 2
  C) 3
  D) 4 
  
   2. An ideal mono.... 
  
  ![](xyz. com)
  
  A) $\frac{3 m_{1} R}{2 m_{2}}$
  B) $-\frac{3 m_{1} R}{2 m_{2}}$
  C) $\frac{3 m_{2} R}{2 m_{1}}$
  D) $-\frac{3 m_{2} R}{2 m_{1}}$
  
  3. A sample of monatomic ideal....
  
  ![](some. url )
  
  A) $\frac{5 V_{0}}{4}$
  B) $\frac{5 V_{0}}{2}$
  C) $\frac{9 V_{0}}{4}$
  D) $\frac{9 V_{0}}{2}$ `;
  </code></pre>
  <p>Expected output:</p>
  <pre><code>
  const output = [
      {
          line: &quot;1. Inner surface of a ....&quot;,
          part: &quot;![](something . com)&quot;,
          some: `
  A) 1
  B) 2
  C) 3
  D) 4 `
      },
      {
          line: &quot;2. An ideal mono.... &quot;,
          part: &quot;![](xyz. com)&quot;,
          some: `
  A) $\frac{3 m_{1} R}{2 m_{2}}$
  B) $-\frac{3 m_{1} R}{2 m_{2}}$
  C) $\frac{3 m_{2} R}{2 m_{1}}$
  D) $-\frac{3 m_{2} R}{2 m_{1}}$
  `
      },
      {
          line: &quot;3. A sample of monatomic ideal....&quot;,
          part: &quot;![](some. url )&quot;,
          some: `
  A) $\frac{5 V_{0}}{4}$
  B) $\frac{5 V_{0}}{2}$
  C) $\frac{9 V_{0}}{4}$
  D) $\frac{9 V_{0}}{2}$ `
      }
  ]
  </code></pre>
  <p>it will be even better if i could get directly it as url but that can be managed via find and replace</p>