我有以下字符串:
This is my testasdasd [Test(XYZ="P")] abc sdfsdf
This is my testasdasd [Test(ABC="P")] sdfsdf
This is my testdfsdfsdf [Test(DEF="P")] sdfsdfs
This is my testsdfsdfsdf [Test(GHI="P")] asdfasdasd
我想要在上述字符串的“)”后添加“,Hello”文本。我的输出应该是这样的:
This is my testasdasd [Test(XYZ="P"), Hello] abc sdfsdf
This is my testasdasd [Test(ABC="P"), Hello] sdfsdf
This is my testdfsdfsdf [Test(DEF="P"), Hello] sdfsdfs
This is my testsdfsdfsdf [Test(GHI="P"), Hello] asdfasdasd
你能帮我制作正则表达式吗?
编辑:我不能通过查找和替换“]”来完成上述操作,我的字符串中也有其他括号。我需要找到 [Test(..)] 并且输出应该是 [Test(...) , Hello]