正则表达式语法 - REGEX [英] Regular expression syntax - REGEX

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

问题描述

大家好,



我需要强制提交正则表达式语法。



请帮助任何人。



我的尝试:



我试过这个< b> ^ [\ w] {1} $



但它只允许一个字符。多个角色失败。

Hi everyone,

I need mandatory filed regular expression syntax.

Please help any one.

What I have tried:

Am tried this one ^[\w]{1}$

But its allowed only one character. more than one character failed.

推荐答案





但是只允许一个角色。多个角色失败。


But its allowed only one character. more than one character failed.


我试过这个^ [\w] {1}
Am tried this one ^[\w]{1}






但它只允许一个字符。不止一个角色失败了。


那是因为这正是你告诉它要做的事情:{1}意味着正是其中之一 - 并且是多余的,正如大多数正则表达式一样,减少到:



But its allowed only one character. more than one character failed.

That's because that is exactly what you told it to do: {1} means "exactly one of" - and is redundant, as is most of that Regex, which reduces to:
^\w


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

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