我怎样才能请求一定数量的(数字)在一定的时间被插入一个输入元素? [英] How could I request a certain number (digit) with a certain times to be inserted in an input element?

查看:169
本文介绍了我怎样才能请求一定数量的(数字)在一定的时间被插入一个输入元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要从某个用户输入一个确定的数字来插入一个输入元素数字,让我们说数字9,在文本或密码字段中,以任何格式..

我怎么能使用HTML5或任何其他方式?



如果我有这样的代码:

 < td><输入类型=9仅限数字placeholder =仅限数字9value =<?php echo htmlentities($ password);?passwordname =passwordmaxlength =9pattern =\d +title = >中/>< / TD> 

然后,我需要的模式为例:(x是任何数字)



xxx999xxx b
$ b 或者:
x9x9x9xxx


或:
9xxx9xxx9



或:
x9xxxx99x

这个问题是每次插入数字9的3倍。

正则表达式使用此工具: http://gskinner.com/RegExr/



这个模式应该可以工作: [^ 9。] * 9 [^ 9。] * 9 [^ 9。] * 9 [^ 9。] *


How could I request a certain digit with a certain times to be inserted in an input element?

I need to request from The users to input three times a certain digit, let we say number 9, in the text or password field, in any format..

How could I do that using HTML5 or any other way?

If I had this code:

<td><input type="password" name="password" maxlength="9" pattern="\d+" title="9 numbers only" placeholder="9 numbers only"  value="<?php echo htmlentities($password); ?>" /></td>

Then, my required pattern to be as example: ("x" is any digit)

xxx999xxx

Or: x9x9x9xxx

Or: 9xxx9xxx9

Or: x9xxxx99x

It doesn't matter the format, the matter is 3 times of number 9 to be inserted every time.

解决方案

You can use this tool for Regular Expressions: http://gskinner.com/RegExr/.

This pattern should work: [^9.]*9[^9.]*9[^9.]*9[^9.]*

这篇关于我怎样才能请求一定数量的(数字)在一定的时间被插入一个输入元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆