具有限制的字母数字和特殊字符的正则表达式 [英] Regex for Alphanumeric and Special characters with limit
本文介绍了具有限制的字母数字和特殊字符的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个正则表达式来验证Person Home地址,其中包含所有字母数字和特殊字符,限制为1 - 150.
ie
House#20-H ,街道#10,F-8/3伊斯兰堡。
电话:+ 92-51-2852662(交换)
传真:+ 92-51-2852663 >
电子邮件:info@pmln.org
我试过这个,但它不起作用......因为它只能使用字符,
i need a regex to validate the Person Home address that includs all alphanumeric and special characters with a limit of 1 - 150.
i.e
House # 20-H, Street # 10, F-8/3 Islamabad.
Ph: +92-51-2852662 (Exchange)
Fax : +92-51-2852663
E-mail: info@pmln.org
I have tried this, but it is not working...as it only accpet characters,
^[a-zA-Z''-'\s]{1,150}$
推荐答案
如果您坚持使用Regex,请尝试:
If you insist on Regex, try this:
^.{1,150}
请记住修剪前导和尾随空格中的字符串在匹配之前。
Remember to trim the string from leading and trailing space before matching.
这篇关于具有限制的字母数字和特殊字符的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文