JavaScript正则表达式中的ignoreCase属性使用详解
ignoreCase是正则表达式对象的只读布尔属性。它指定是否一个特定的正则表达式执行不区分大小写的匹配。,它与“i”属性创建。
语法
RegExpObject.ignoreCase
下面是参数的详细信息:
- NA
返回值:
- 如果“i”修改被设置返回“TRUE”,否则返回“FALSE”。
例子:
<html>
<head>
<title>JavaScriptRegExpignoreCaseProperty</title>
</head>
<body>
<scripttype="text/javascript">
varre=newRegExp("string");
if(re.ignoreCase){
document.write("Test1-ignoreCasepropertyisset");
}else{
document.write("Test1-ignoreCasepropertyisnotset");
}
re=newRegExp("string","i");
if(re.ignoreCase){
document.write("<br/>Test2-ignoreCasepropertyisset");
}else{
document.write("<br/>Test2-ignoreCasepropertyisnotset");
}
</script>
</body>
</html>
这将产生以下结果:
Test1-ignoreCasepropertyisnotset Test2-ignoreCasepropertyisset
热门推荐
10 读书祝福语女生短句简短
11 感谢同事新婚祝福语简短
12 感谢教官文案祝福语简短
13 员工聚会蛋糕祝福语简短
14 元宵发客户祝福语简短
15 给团队信心祝福语简短
16 医美的祝福语大全简短
17 异国姻缘的祝福语简短
18 兄妹拍照祝福语简短的话