ignoreCase是RegExp对象的只读布尔属性。它指定特定的正则表达式是否执行不区分大小写的匹配,即是否使用" i"属性创建。
RegExp.prototype.ignoreCase - 语法
RegExpObject.ignoreCase
RegExp.prototype.ignoreCase - 返回值
如果设置了" i"修饰符,则返回" TRUE",否则返回" FALSE"。
RegExp.prototype.ignoreCase - 示例
var re=new RegExp( "string" ); if ( re.ignoreCase ){ console.log("Test1-ignoreCase property is set"); } else { console.log("Test1-ignoreCase property is not set"); } re=new RegExp( "string", "i" ); if ( re.ignoreCase ) { console.log("Test2-ignoreCase property is set"); } else { console.log("Test2-ignoreCase property is not set"); }
运行上面代码输出
Test1-ignoreCase property is not set Test2-ignoreCase property is set
参考链接
https://www.learnfk.com/es6/es6-regexp-prototype-ignorecase.html
标签:prototype,set,log,无涯,ignoreCase,RegExp,property From: https://blog.51cto.com/u_14033984/9637939