需要正则表达式 [英] Regular Expression Needed

查看:82
本文介绍了需要正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,需要通过以下方式进行验证:用户应输入字符,然后输入数字.他们不能同时混淆两者.

例如:

用户不应键入a133bv2、232ds等

必须是abc123

请提供相同的正则表达式.

I have a textbox which needs to be validated in such a way that user should enter characters followed by numbers. They cannot mixup both.

For Eg:

User should not be able to type a133bv2,232ds etc

It must be abc123

Please provide the regular expression for the same.

推荐答案

^[a-zA-Z]*[0-9]*




如果需要至少一位数字和至少一个字符,请将"*"替换为"+":



If at least one digit and at least one character is required, replace "*" with "+":

^[a-zA-Z]+[0-9]+





—SA




—SA


这篇关于需要正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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