更新时间:2022-12-07 19:19:41
试试这个正则表达式:
^(A(B(C)?)?)?$
我认为您可以看到该模式并将其扩展为 ABCD
和 ABCDE
,如:
I think you can see the pattern and expand it for ABCD
and ABCDE
like:
^(A(B(C(D)?)?)?)?$
^(A(B(C(D(E)?)?)?)?)?$
现在每个部分都依赖于前面部分( B 取决于 A , C 取决于 B 等)。
Now each part depends on the preceeding parts (B depends on A, C depends on B, etc.).