how to validate content of text file using JavaScript?
<p>How can i validate the content of text file using javascript? For instance i have a single text file consists of :</p>

<pre><code>    6594567890
    6594567891
    6594567892
    6594567893
    92345678
    92345679
    92345680
</code></pre>

<p>Accordingly, I need to validate the content with certain conditions:</p>

<ol>
<li>if its prefix is not equal to 659 and 9 then it will be rejected.</li>
<li>if its prefix is equal to 659 but the length is not equal to 10 then it will be rejected.</li>
<li>if its prefix is equal to 9 but the length is not equal to 8 then it will be rejected.</li>
</ol>

<p>Currently i have the following codes using JS:</p>

<pre><code>    &lt;input type="file" name="txt_list" id="txt_list" class="inpText" size="26"  /&gt;
    &lt;script&gt;
          var input_file = document.getElementById('txt_list');
          input_file.onchange = function() {
          var file = this.files[0];
          var reader = new FileReader();
          reader.onload = function(ev) {
              // Show content  (ev.target === reader)
              alert(ev.target.result);
            };
             reader.readAsText(file);
          };
     &lt;/script&gt;
     &lt;font color="FF0000" style="font-weight:bolder;"&gt;
                            &lt;b&gt;* Compulsory&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
     &lt;/font&gt;
</code></pre>

<p>Any ideas how to do this? jsfiddle or sample codes will be highly appreciated.</p>
