<script type="text/javascript">
  <!--
    function MatchDemo(){
   var r, re;         // 声明变量。
   var s = "The123 rain in Spain falls mainly in the plain";
   re = /ain/ig;      // 创建正则表达式模式。
   r = s.match(re);   // 尝试去匹配搜索字符串。
   //debugger;
   //return(r);         // 返回的数组包含了所有 "ain" 
                      // 出现的四个匹配。
//////////////////////////////////////
    var regex=/((T\w*)e)(\d*)/;
    var matches=    regex.exec(s);
    debugger;
    /*
结果:matches    ["The123", "The", "Th", "123"]    
0    "The123"    
1    "The"    
2    "Th"    
3    "123"    
index    0    
input    "The123 rain in Spain falls mainly in the plain"
    */
}
  //-->
  </script>