开发者

Regex in new pattern attr for HTML5 forms

开发者 https://www.devze.com 2023-02-20 01:10 出处:网络
I am just using HTML5 forms for the first time and I want to use the new pattern attribute. This is a regular expression (which I haven\'t used before) so I am 开发者_StackOverflow社区a bit lost. The

I am just using HTML5 forms for the first time and I want to use the new pattern attribute. This is a regular expression (which I haven't used before) so I am 开发者_StackOverflow社区a bit lost. The basic rule I want is 'minimum 5 of any characters'

I have tried:

pattern="([0-9][A-Z]){5}"

but this doesnt work so I am obviosuly missing something obvious. Would be most grateful if anyone could help me out.


The basic rule I want is 'minimum 5 of any characters'

.{5,}

This will match any character (except \n) at least 5 times.


[0-9a-zA-Z]{5,}

--padding for the answer to be accepted by the system (at least) :P

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号