Javascript for matching text while typing
<p>Basically, i need a code that constantly checks for how many times a particular string appears within a textarea everytime the user keys in a letter. </p>

<pre><code>  &lt;textarea name="t_update" cols="50" rows="5" id="t_update" style="width:30%"
 onKeyUp="check()" &gt;&lt;/textarea&gt;

 &lt;script&gt;
     function check(){
         var cText = document.getElementById('t_update').value;
         if (cText.match("abc")){
             //Do something
         }else{
             //Do something else.
         }
         alert(cText.match("abc").length);
     }
 &lt;/script&gt;
</code></pre>

<p>The current code i have only returns one even if i have a more than one match. Any help would be appreciated.</p>
