返回 Boolean 值指出正则表达式使用的 ignoreCase 标志(i) 的状态默认值为 false只读
rgExpignoreCase必选项 rgExp 参数为 RegExp 对象
说明
如果正则表达式设置了 ignoreCase 标志那么 ignoreCase 属性返回 true否则返回 false
如果使用了 ignoreCase 标志那就表明在被查找的字符串中匹配样式的时候查找操作将不区分大小写
示例
以下示例演示了 ignoreCase 属性的用法如果传递 i 到下面所示的函数中那么所有的单词 the 将被 a 替换包括最开始位置上的 The这是因为设置了 ignoreCase 标志搜索操作将不区分大小写所以在进行匹配的时候 T 与 t 是等价的
此函数返回一个字符串以及一个表表中显示了与允许使用的正则表达式标志(gi 和 m)相关的属性值它还返回经过所有替换操作后的字符串
function RegExpPropDemo(flag){
if (flagmatch(/[^gim]/)) //检查标志的有效性
return(Flag specified is not valid);
var r re s //声明变量
var ss = The man hit the ball with the bat\n;
ss = while the fielder caught the ball with the glove;
re = new RegExp(theflag); //指定要查找的样式
r= ssreplace(re a); //利用 a 替换 the
s = Regular Expression property values:\n\n
s = global ignoreCase multiline\n
if (reglobal) //测试 global 标志
s = True ;
else
s = False ;
if (reignoreCase) //测试 ignoreCase 标志
s = True ;
else
s = False ;
if (remultiline) //测试 multiline 标志
s = True ;
else
s = False ;
s = \n\nThe resulting string is:\n\n r;
return(s); //返回替换的字符串
}