HTML5输入模式不区分大小写 [英] HTML5 Input Pattern Case-Insensitivity
问题描述
I'm trying to create something right now and I need the pattern
attribute that was introduced in html5 tp be case-insensitive but as far as I know, you can't have flags to do this.
2011年,有人问了一个问题有人说输入模式区分大小写,我希望此后可以更改.如果没有,我想知道是否有一种方法可以使模式变得不区分大小写.我不能只使用基本的[a-zA-z]
,因为我需要匹配一个四个字母的单词,因此,举个例子,它会从很长的(word)|(WORD)|(Word)|(wOrd)
开始……等等.
There was a question asked in 2011 where it was stated that input patterns are case-sensitive and I was hoping that this was changed since then. If not, I'd like to know if there is a way to get a pattern to become case-insensitive. I can't just use the basic [a-zA-z]
because I need to match a four letter word so as an example, it would start off really long (word)|(WORD)|(Word)|(wOrd)
... and so on.
有没有办法得到这样的不区分大小写的模式?
Is there a way to get a case-insensitive pattern like this?
似乎我没有详细说明我的细节,我需要一个特定的单词,而不仅仅是4个字母的单词.
Appears I haven't been to specific in my details, I need a specific word, not just any 4 letter word.
推荐答案
好吧,我认为除了列出每个组合之外,我还想出了一种更简单的方式来做模式.
Ok I think I figured out an easier way to do the pattern other than listing each combination.
作为示例,我将使用五个"一词.
As an example, I'll use the word, "five".
[fF][iI][vV][eE]
如此
pattern="[fF][iI][vV][eE]"
这篇关于HTML5输入模式不区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!