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.
我想在方括号中获取包含管道字符的文本。
例如来自:
"ERROR|appLogger|[File|name|upload<failed on server:5645>]Execution Failed[check server address][com.package.file.upload]"
我想提取:
"File|name|upload<failed on server:5645>"
编辑:小修正以捕捉类似的东西[|]。
[|]
试试这个:
\[(([^\]]*\|[^\]]*))\]
在这里查看它的实际应用。
这是正则表达式
(?<=\[).*?\|.*?\|.*?(?=\])