Angular.js中字母数字的正则表达式 [英] Regular expression for alphanumeric in Angularjs
本文介绍了Angular.js中字母数字的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个用于angularJS中字母数字字符的正则表达式,我已经尝试过一些正则表达式,例如(\ d [a-z])",但它们只允许我输入数字和字母.但是我想要一个正则表达式,不允许我输入它们.
I want a regex for alphanumeric characters in angularJS, I've tried some regex like "(\d[a-z])" but they allow me to enter only number as well as only alphabets. But I want a regex which won't allow me to enter them.
示例: 121232,abchfe,abd()*,42232 ^ 5 $ 是无效输入的示例. 12fUgdf,dGgs1s23 是一些有效输入.
Example: 121232, abchfe, abd()*, 42232^5$ are some example of invalid input. 12fUgdf, dGgs1s23 are some valid inputs.
推荐答案
此解决方案要求至少一个(a-z,A-Z和0-9)之一:
This one requires atleast one of each (a-z, A-Z and 0-9):
^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])([a-zA-Z0-9]+)$
这篇关于Angular.js中字母数字的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文