Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能写出这样的模式:
例如:01, , -1, 1500, abc 等 - 为假
现在我只有数字检查:
:pattern => "[0-9]{1,4}"
那么如何写我的模式呢?
假设您的意思是不允许使用符号(+ 或 -),并且“Null Can't be first char”意味着输入不得以数字零 (0) 开头,除非输入正好为 0,以下是 HTML 代码:
<input pattern="0|[1-9]\d{0,2}" required>