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 入住酒店文案祝福语简短