JScript 8.0 中文手册| 首页 | asp之家
ignoreCase 属性

返回布尔值,该值指示在正则表达式中使用的 ignoreCase 标志 (i) 的状态。

rgExp.ignoreCase
参数
rgExp

必选。Regular Expression 对象的一个实例。

备注

ignoreCase 属性是只读的,并且如果 ignoreCase 标志是为正则表达式设置的,则返回 true,否则返回 false。默认值为 false

如果使用了 ignoreCase 标志,则该标志将指示被搜索字符串中执行模式匹配的一个搜索应该不区分大小写。

示例

下面的示例阐释了 ignoreCase 属性的用法。

function RegExpPropDemo(re : RegExp) {
   print("Regular expression: " + re);
   print("global:     " + re.global);
   print("ignoreCase: " + re.ignoreCase);
   print("multiline:  " + re.multiline);
   print();
};
// Some regular expression to test the function.
var re1 : RegExp = new RegExp("the","i");  // Use the constructor.
var re2 = /\w+/gm;                         // Use a literal.
RegExpPropDemo(re1);
RegExpPropDemo(re2);
RegExpPropDemo(/^\s*$/im);

该程序的输出为:

Regular expression: /the/i
global:     false
ignoreCase: true
multiline:  false
Regular expression: /\w+/gm
global:     true
ignoreCase: false
multiline:  true
Regular expression: /^\s*$/im
global:     false
ignoreCase: true
multiline:  true
要求

版本 5.5

应用于:

请参见

参考

global 属性
multiline 属性

概念

正则表达式语法