我需要以下模式的正则表达式 [英] I need a regex for the following patterns

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

问题描述

我需要检查给定的输入字母数字和数字争用位数,最大长度为7个字符

字符串以字母或数字开头
字符串以字母或数字结尾

例如:abc123456bcvdgd
例如:1254673abchetet123
例如:abxchhfh1234423

请对此提供帮助

我尝试过的事情:

我已经尽我最大的努力了,我找不到任何东西

I need check given input alphanumerical and numeric contentions digits length max 7 characters

String start with alpha or number
string end with alpha or number

ex: abc123456bcvdgd
Ex: 1254673abchetet123
Ex : abxchhfh1234423

kindly help on this

What I have tried:

I have tried my level best i couldn''t found any thing

推荐答案

尝试比答案"更简单的帮助吸血鬼:
Try even simpler than the "answer" the help vampire posted:
^[\da-zA-Z]{0,7}



如果允许您使用下划线,那么它很简单:


If you are allowed underlines then it''s trivial:

^\w{0,7}


但是请注意,您的示例都失败了...

But do notice that your examples all fail...


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

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