如何确保一个文本框是字母,但没有一个领先的数字吗? [英] How do I ensure a text box is alphanumeric but without a leading digit?
本文介绍了如何确保一个文本框是字母,但没有一个领先的数字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的Web应用程序包含一个文本框,我想限制其输入。我想prevent进入文本用户:
My web application contains a text box for which I would like to restrict its input. I would like to prevent the user from entering text that:
- 以空格开始
- 比数字以外的东西开始
- 开头的字符后包含字母数字字符。
感谢您的建议!
推荐答案
不先从字母数字的空白: [A-ZA-Z] +
其次是0个或多个字母: [A-ZA-Z0-9] *
Not to start with white space of alpha numeric: [a-zA-Z]+
Followed by 0 or more alphanumeric: [a-zA-Z0-9]*
决赛前pression
Final expression
^[a-zA-Z]+[a-zA-Z0-9]*$
这篇关于如何确保一个文本框是字母,但没有一个领先的数字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文