-1

パイプ文字を含む角括弧内のテキストを取得したい。

たとえば、次のようになります。

"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>"
4

2 に答える 2

3

Edit: Small correction to catch stuff like [|] as well.

Try this:

\[(([^\]]*\|[^\]]*))\]

See it in action here.

于 2012-08-17T11:53:13.790 に答える
1

これは正規表現です

(?<=\[).*?\|.*?\|.*?(?=\])
于 2012-08-17T11:50:16.853 に答える