Javascript regular expression: {n}

<input type="button" value="Match" onclick="javascript:demo1('hello');return false;" />
&nbsp;&nbsp;&nbsp;
<input type="button" value="No Match" onclick="javascript:demo1('help');return false;" />

<script type="text/javascript" language="JavaScript">
//<![CDATA[
   function demo1(text) {
      var re = /l{2}/;
      if (text.match(re)) {
         alert("match");
      } else {
         alert("no match");
      }
   }
//]]>
</script>


   


<input type="button" value="Match" onclick="javascript:demo2('ohoh');return false;" />
&nbsp;&nbsp;&nbsp;
<input type="button" value="No Match" onclick="javascript:demo2('oh');return false;" />

<script type="text/javascript" language="JavaScript">
//<![CDATA[
   function demo2(text) {
      var re = /(oh){2}/;
      if (text.match(re)) {
         alert("match");
      } else {
         alert("no match");
      }
   }
//]]>
</script>