Javascript regular expression: split()


<input type="button" value="Split" onclick="javascript:demo([email protected]@world.');return false;" />
&nbsp;&nbsp;&nbsp;
<input type="button" value="No Split" onclick="javascript:demo('hello great world.');return false;" />


<script type="text/javascript" language="JavaScript">
//<![CDATA[
   function demo(text) {
      var re = /@/;
      var found = text.split(re);
      if (found != null && found.length > 1) {
         alert("found = " + found);
         for(i=0;i<found.length;i++){
            alert("found[" + i + "]= " + found[i]);
         }
      } else {
         alert("no match");
      }
   }
//]]>
</script>