Splitting string with multiple delimiters into a hash table in JavaScript
<p>I'm trying to figure out how to split a string using regex while having the results placed into a hash table.</p>

<p>Example:</p>

<pre><code>var x = "Name: John Doe
Age: 30
Birth Date: 12/12/1981";

var arr = x.split(/Name:|Age:|Birth Date:/);
</code></pre>

<p>However while I can spit a string the problem is I can't store the values into a useful format such as a hash etc. Since some of the information may not always be shown.</p>

<p>I would want the results to be something like:</p>

<pre><code>var myHash = {}; // New object
myHash['Name'] = "John Doe";
myHash['Age'] = "30";
myHash['Birth Date'] = "12/12/1981";
</code></pre>

<p>Is there an easy why to do this?</p>

<p>Edit: The script is used to parse data from a generated report. And the format does not always have carriage returns. It's going to be used to automatically generate notices instead of hand typing everything.</p>

<p>Example:</p>

<pre><code>Name: John Doe       Birth Date: 12/12/1981
Age: 30
</code></pre>

<p>However, after seeing examples I may be able to do it if I first add a carriage return or other special character in front of the regex matches. Need to figure out how to add a value in front of the regex matches first.</p>
