正则表达式替换匹配模式的多个行

Bow*_*owe 5 regex

如果我有一堆这样的文字

The cat sat on the mat
Expropriations for international monetary exchange ( Currenncy: Dollars,
                                                     Value: 50,000)
The cat sat on the mat
Expropriations for international monetary exchange ( Currenncy: Yen)
The cat sat on the mat
Run Code Online (Sandbox Code Playgroud)

有没有我可以在查找使用/替换我的文本编辑器(JEDIT)的功能来识别所有的线的正则表达式开头单词Expropriations一个右括号结束,然后把这些线在方括号内,使它们看起来像这样:

The cat sat on the mat
[Expropriations for international monetary exchange ( Currenncy: Dollars,
                                                     Value: 50,000)]
The cat sat on the mat
[Expropriations for international monetary exchange ( Currenncy: Yen)]
The cat sat on the mat
Run Code Online (Sandbox Code Playgroud)

棘手的是,右括号可能会落在与"征收"一词相同的行尾或下一行的末尾.(在括号关闭之前,甚至可能有多行)

cod*_*ict 2

您可以匹配:

^(Expropriations[\d\D]*?\))
Run Code Online (Sandbox Code Playgroud)

并将其替换为:

[$1]
Run Code Online (Sandbox Code Playgroud)

\d\D匹配任何单个字符,包括换行符。