I need to have HTML's input elements pattern ignore the case of the value,
like have if the regex is /[a-z]*/ could I get it to match all uppercase letters too?
(I know I could just do /[a-zA-Z]*/, but that was an example.)
相关问题
- Improve converting string to readable urls
- Regex to match charset
- Regex subsequence matching
- Jasper: error opening input stream from url
- Accommodate two types of quotes in a regex
相关文章
- HTML5 control
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- Optimization techniques for backtracking regex imp
- Regex to check for new line
- Allow only 2 decimal points entry to a textbox usi
- Show a different value from an input that what wil
- Comparing speed of non-matching regexp
- Is there a way to hide the new HTML5 spinbox contr
I don't think it is possible.
The specification on
<input pattern>
[1,2] specifies thatthe pattern uses the ECMAScript (i.e. Javascript) flavor of regex
it is compiled "with the global, ignoreCase, and multiline flags disabled"
In Javascript, the only way to make a regex ignore case is to set the modifier externally (
/.../i
). The PCRE syntax(?i)
is not supported.Therefore, the pattern is always case-sensitive and
[a-zA-Z]*
(i.e. making the regex itself explicitly case insensitive) is the only way to match the pattern in a case-insensitive way.