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.
您不能使用反向引用来(匹配). 你只需要明确地匹配它。
(
)
例如,这将匹配<and中的某些内容>:
<
>
r'<.*>'
这将匹配 and 内的某些[内容]:
[
]
r'\[.*\]'
要匹配其中任何一个,请使用|, 表示或:
|
r'(<.*>)|({.*})|(\(.*\))|(\[.*\])'