字母数字和退格的正则表达式 [英] Regular Expression for alphanumeric and backspace

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

问题描述

我有一个由按键处理的文本框。我希望文本框必须只接受字母,数字并允许他按退格键。



我的正则表达式是([^ a-zA-Z0-9])



但退格不起作用



感谢您的快速回复



谢谢

解决方案

可能会对你有帮助。

http://regexlib.com/CheatSheet.aspx [ ^ ]



http://stackoverflow.com/questions/4736/learning-regular-expression [ ^ ]


退格通常适用于任何正则表达式验证,因为为字符串调用了reg验证。



您可以尝试

http://www.siteexperts.com/tips/functions/ts23/page1.asp [ ^ ]



整个正则表达式列表。



:rose:


尝试从<更改正则表达式 br $>


[^ a-zA-Z0-9]



to



^ [a-zA-Z0-9 [\ b]]



希望这样可行。



如果有帮助,请 投票 接受答案

I have a textbox that is handled by a keypress. I want the textbox must accept only alphabet, numbers and allowing him to press the backspace.

my regular expression is ([^a-zA-Z0-9])

but the backspace does not work

thanks for any fast reply

THANKS

解决方案

May be this could help you.
http://regexlib.com/CheatSheet.aspx[^]

http://stackoverflow.com/questions/4736/learning-regular-expression[^]


Backspace generally works for any regex validation as reg validation is invoked for the string.

You can try
http://www.siteexperts.com/tips/functions/ts23/page1.asp[^]

for entire regex list.

:rose:


Try by changing this Regex from

[^a-zA-Z0-9]

to

^[a-zA-Z0-9[\b]]

Hope this will work.

Please vote and Accept Answer if it Helped.


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

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