Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要帮助编写以下规则的正则表达式:
[]
我想出了这个表达:
[^(\\[\s\\])]
但在这种情况下,每个 chars: [、空格和]不允许单独使用。
[
]
请帮忙
谢谢
有很多方法可以做到这一点。这是一个:
^([^\s\[]*(\[[^\]]*)*)*$
您可以使用如下表达式:
^(?:[^][\s]|\[[^]]*\])*\z
^(\S|\[.*?])*$
\S
|
\[.*?]