正则表达式中需要的帮助 [英] Help needed in Regular Expression

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

问题描述



我需要一个正则表达式,它应该以5位数至6位数的模式显示,在这些数字之间,我需要输入0或1个出现的字母.请帮帮我.
像这样的例子:

a1111-111111,11a11-111111,11111-111a11,11111-11111a

Hi,

I need a regular expression where it should in pattern of 5digits-6digits, in between these digits I need to enter 0 or 1 occurrence of alphabets. Please help me.
examples like :

a1111-111111,11a11-111111,11111-111a11,11111-11111a

推荐答案

正则表达式(通常称为regex)是一种包含用于匹配一组特定的字符串.它们非常强大,您会遇到的大多数编程语言都需要它们,尤其是当需要扫描和匹配上下文以采取进一步措施时.

这里有30种有用的工具和资源,希望对您有帮助:
http://www.hongkiat.com/blog/regular-expression-tools-resources/ [ ^ ]
Regular expression, or often known as regex, is a pattern that consist of rules used to match a certain set of strings. They are extremely powerful, and you’ll need them in most programming languages you come across, especially when there’s a need to scan and match context for further actions.

Here’s a 30 Useful Tools & Resources, I hope it will help you:
http://www.hongkiat.com/blog/regular-expression-tools-resources/[^]


请参阅下面的文章,您将自己找到解决方案

30分钟正则表达式教程 [ ^ ]
See below article you will find solution yourself

The 30 Minute Regex Tutorial[^]


您应该努力了解有关正则表达式的更多信息.开始的好地方是此处.另一个非常有用的网站是 regexlib [ ^ ];他们有一个大的正则表达式库.他们也有一个正则表达式测试仪 [<一个HREF = http://regexlib.com/(X(1)A(knbcnrG7H-2ViXlEFAAiQcn0ih9raBO1q950pBfHc0chZ_EGd-9FgwnAOtHsD5Bl-T9YJw8R_rYssQIjku8zeMf_LxfyeEqrkWrMvHv_tYxPh6Jwy2ybh472XEy-VAyj4n010hw81cwOl1Qusrd9tvzrPtxKoWZ_j5w7zXqTtpPI3J44KQZKIy25UmuFJuK10))/RETester.aspx" 目标= _空白" 标题= 新窗口"> ^ ].在此处也可以使用非常有用的RegEx工具.
You should make an effort to learn more about Regular Expressions. A good place to get started is here. Another very helpful site is regexlib[^]; they have a large library of Regular Expressions. They also have a RegEx tester[^]. Also a very useful RegEx tool is available here.


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

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