<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>正则对象</title>
</head>
<body>
<script>
//1.匹配方式一
// var re_obj=new RegExp('d+','g');//g 为一种全局模式
// alert(re_obj.test('dajsasj5613ss'));//true
//2.匹配方式二
// var re_obj=/d+/g;
// alert(re_obj.test('sddhdj852sss51'));//true
//3.取出匹配的内容
var reg='asdfltxstar1997xing315'
// alert(reg.match(/d/g));//1,9,9,7,3,1,5 取出所有匹配的内容放到数组里
// alert(reg.match(/d+/g));//1997,315
// alert(reg.search(/d+/g));//11 取出第一个结果的索引值
// alert(reg.split(/d+/g));//asdfltxstar,xing,
alert(reg.replace(/d+/g,'*'));//asdfltxstar*xing*
// ------------------------------------------------------
//Math对象
// alert(Math.random())//(0,1)
// alert(Math.round(2.6))//3
alert(Math.pow(2,4))//16
</script>
</body>
</html>