Find text between two characters and for each, do something
<p>I have a file full with text in the following format:
(ignoring the fact that it is CSS) I need to get the string between the two | characters and each time, do something:</p>

<pre><code>&lt;div id="unused"&gt;
  |#main|
  #header|
  .bananas|
  #nav|
  etc
&lt;/div&gt;
</code></pre>

<p>The code I have is this:</p>

<pre><code>var test_str = $('#unused').text();
var start_pos = test_str.indexOf('|') + 1;
var end_pos = test_str.indexOf('|',start_pos);
var text_to_get = test_str.substring(start_pos,end_pos);
//I want to do something with each string here
</code></pre>

<p>This just gets the first string. How can I add logic in there to do something for each string? </p>
