JavaScript RegExp 对象使用技巧
1、RegExp 可以简单到一个字母的检测,也可以复杂到一些元素的样式的检测。所有的检测结果会反馈在网页的上面。

2、一个检测百字的案例。
<html>
<body>
<script type="text/javascript">
var patt1=new RegExp("百");
document.write(patt1.test("百度经验人人爱,百度经验就是好"));
</script>
</body>
</html>

3、英文也可以检测出来。
<html>
<body>
<script type="text/javascript">
var patt1=new RegExp("o");
document.write(patt1.test("I love this book and you?"));
</script>
</body>
</html>

4、exec() 这个代码就是返回一个变量相同值的作用。如果句中没有,这个值就是nulll。
<html>
<body>
<script type="text/javascript">
var patt1=new RegExp("e");
document.write(patt1.exec("This is right"));
</script>
</body>
</html>

5、另外一种用法就是用两个参数。RegExp("e","g")
<html>
<body>
<script type="text/javascript">
var patt1=new RegExp("e","g");
do
{
result=patt1.exec("bee and eggs");
document.write(result);
}
while (result!=null)
</script>
</body>
</html>

6、compile() 也是一个重要的检测代码,它在使用的时候 可以改变这个RegExp()结果。
