测试数据
1: "Abc.TestCase For TestCase By Abc.TestCase Using TestCase"           --> 2 matches 
2: "(Abc.TestCase For TestCase By Abc.TestCase Using TestCase)"         --> 2 matches
3: "(TestCase For TestCase By Abc.TestCase Using TestCase)"             --> 3 matches
4: "(Abc.TestCase For TestCase By Abc.TestCase Using Xyz.TestCase.Sub)" --> 1 match
5: "(Abc.TestCase For TestCase By Abc.TestCase Using Xyz.TestCase1)"    --> 1 match
目标是获取不合格的“TestCase”
尝试了以下
[^.]\bTestCase\b[^.]
虽然这可行,但它在 2 和 3 情况下失败,它返回 "(TestCase" "TestCase)" 作为匹配项,这会导致替换的错误结果。
对此束手无策!
将不胜感激这里的一些帮助。
