RegExp实例属性

2017-06-15 19:01:00
admin
原创
488
<!DOCTYPE html>
<html>
<head>
    <title>RegExp Instance Properties Example</title>
    <script type="text/javascript">
        var pattern1 = /\[bc\]at/i;
        
        alert(pattern1.global);     //false
        alert(pattern1.ignoreCase); //true
        alert(pattern1.multiline);  //false
        alert(pattern1.lastIndex);  //0
        alert(pattern1.source);     //"\[bc\]at"

        var pattern2 = new RegExp("\\[bc\\]at", "i");
        
        alert(pattern2.global);     //false
        alert(pattern2.ignoreCase); //true
        alert(pattern2.multiline);  //false
        alert(pattern2.lastIndex);  //0
        alert(pattern2.source);     //"\[bc\]at"

    </script>
</head>
<body>

</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络