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.
我将如何编写一个正则表达式来匹配第一个示例,而不是第二个示例?
谢谢 -
尝试
\[Test\]
您需要转义[and]因为它们指示范围开始/结束。
[
]
[]是正则表达式的特殊字符,用于定义字符类,因此用反斜杠转义它们。
[]
如果使用[Test],它将匹配单个字符,即T、或。est
[Test]
T
e
s
t