有办法吗?我要
"windows": [
{ "x": 2, "y": 0 }
]
以一无所有而告终。如果括号中也有更多坐标,我希望同样发生。
答案 0 :(得分:0)
Ctrl + H 查找内容:(?:^ |(?<=]))[^] [] *?(?= [| $) 替换为:留空 检查环绕 检查正则表达式 全部替换
说明:
(?:#启动非捕获组
^#行首
| # 要么
(?<=])#正向后看,零长度断言that
确保之前有一个方括号
)#个结束组
[^] [] *? #否定字符类,任何
没有打开或关闭方括号,可能出现0次或多次,不是贪婪
(?=#开始正向超前,零长度断言 确保我们拥有 [#一个开放的方括号 | # 要么 $#行尾 )#ed lookahead
给定示例的结果:
[A B C] [D E F] [G H I] [J K L] M N O] [P Q R [S T U]
答案 1 :(得分:0)
^\h*"windows":\h*\[\s+{.+?}\s+\]\s+
LEAVE EMPTY
说明:
^ # beginning of line
\h* # 0 or more horizontal spaces
"windows": # literally
\h* # 0 or more horizontal spaces
\[ # opening square bracket
\s+ # 1 or more any spaces, including linebreak
{ # opening brace
.+? # 1 or more any character, not greedy
} # closing brace
\s+ # 1 or more any spaces, including linebreak
\] # closing square bracket
\s+ # 1 or more any spaces, including linebreak
屏幕截图(之前):
屏幕截图(之后):