更新时间:2023-02-25 22:29:29
\b(?!(?:。\B)*(。)(?: \B。)* \ 1)[abc] + \ b
您可以使用此与任何设置和大小的模式,只需用所需的设置替换 [abc]
...
$ b $ hr
示例:
(以上输出来自 myregextester )
How can I match letters a,b,c once in any combination and varying length like this:
The expression should match these cases:
abc
bc
a
b
bca
but should not match these ones:
abz
aab
cc
x
Use regex pattern
\b(?!(?:.\B)*(.)(?:\B.)*\1)[abc]+\b
You can use this pattern with any set and size, just replace [abc]
with desired set...
(above output is from myregextester)