RegExp.prototype.ignoreCase
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
ignoreCase 属性表明正则表达式是否使用了 "i" 标志。ignoreCase 是正则表达式实例的只读属性。
RegExp.prototype.ignoreCase 的属性特性 | |
|---|---|
| 可写 | 否 |
| 可枚举 | 否 |
| 可配置 | 否 |
描述
ignoreCase 的值是布尔对象,如果使用了"i" 标志,则返回 true;否则,返回 false。"i" 标志意味着在字符串进行匹配时,应该忽略大小写。
你无法直接更改此属性。
示例
>示例:使用 ignoreCase
js
var regex = new RegExp("foo", "i");
console.log(regex.ignoreCase); // true
规范
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-get-regexp.prototype.ignorecase> |
浏览器兼容性
Loading…