^\s*[)]*\s*$ 并^\s*[(]*\s*$匹配括号(和)粗体.也就是说,我想要的是忽略单个而不是(condition1)括号的括号:
while
( #matches here
( #matches here
(condition1) && (condition2) &&
condition3
) ||
(#matches here
(condition4) ||
condition5 &&
(condition6)
) #matches here
) #matches here
Run Code Online (Sandbox Code Playgroud)
但如果我喜欢这个,它就不匹配:
while
(( #does not match here
(condition1) && (condition2) &&
condition3
) ||
(
(condition4) ||
condition5 &&
(condition6)
) ) #does not match here
Run Code Online (Sandbox Code Playgroud)
要么
while
((( #does not match here
(condition1) && (condition2) &&
condition3
)) ||
(( #does not match here
(condition4) ||
condition5 &&
(condition6)
) ) ) #does not match here
Run Code Online (Sandbox Code Playgroud)
如何匹配所有单个括号?
| 归档时间: |
|
| 查看次数: |
596 次 |
| 最近记录: |