[英]How to create regex for name pattern with include and exclude characters in Spring application
I want to create regex with following conditions我想创建具有以下条件的正则表达式
/
*
?
/
*
?
"
<
>
|
"
<
>
|
(space character) ,
#
,
#
-
_
+
-
_
+
开头or
.. or
.. Here is my regex:这是我的正则表达式:
[^A-Z+\/\\*?"<>|`` `,#.][a-z0-9_+-]+
Above regex satisfy above condition [1] and [3] but not [2].以上正则表达式满足上述条件 [1] 和 [3] 但不满足 [2]。 How should I satisfy above conditions using the regex?
我应该如何使用正则表达式满足上述条件?
Something like:就像是:
^[a-zA-Z0-9][a-zA-Z0-9_-]*$
Should work, though no periods would be acceptable at all, not just the .
应该可以工作,尽管根本不接受任何时期,而不仅仅是
.
and ..
patterns.和
..
模式。
edit, maybe?编辑,也许?
^[a-zA-Z0-9][a-zA-Z0-9_-][^.][^..]*$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.