[英]Javascript Regular expression (?i)^inf
I want to know what this regular expression refers. 我想知道这个正则表达式指的是什么。
(?i)^inf
With examples 有例子
It's easy to figure : type /(?i)^inf/
in the console. 很容易/(?i)^inf/
在控制台中键入/(?i)^inf/
。
Conclusion : it's an invalid regular expression in JavaScript. 结论:这是JavaScript中的无效正则表达式。
But I guess you saw this regex in another language. 但是我想你看到了另一种语言的正则表达式。 If you want to use flags in JavaScript regular expressions , the syntax is different : 如果要在JavaScript正则表达式中使用标志 ,则语法不同:
/^inf/i
What it means is : a string starting with "inf"
, with case insensitive matching. 这意味着:以"inf"
开头的字符串,不区分大小写。
JavaScript doesn't support inline modifiers such as (?i)
(see below). JavaScript不支持内联修饰符,例如(?i)
(请参见下文)。 This regex is not proper JavaScript syntax. 此正则表达式不是正确的JavaScript语法。
inf
, case-insensitive. 还有许多其他类型...以inf
开头的任何字符串,不区分大小写。 In .NET, Java, PCRE, Perl, Python, Ruby and a number of other engines, (?i)
turns on case-insensitivity. 在.NET,Java,PCRE,Perl,Python,Ruby和许多其他引擎中, (?i)
启用不区分大小写的功能。
Sample matches 样品搭配
infact
inFahrenheit
INF
INFO
INfine
How it Works 这个怎么运作
(?i)
turns on case-insensitivity mode (?i)
打开不区分大小写的模式 ^
anchor asserts that we are at the beginning of the string ^
锚断言我们在字符串的开头 inf
matches literal characters inf
匹配文字字符 I don't know it supports in Java-script or not. 我不知道它是否支持Java脚本。
But i got to know (?i)
means case-insensitive 但我知道(?i)
表示不区分大小写
Example:- 例:-
(?i)integer matches Integer, inTeger, etc,.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.