【发布时间】:2020-10-22 10:53:31
【问题描述】:
我需要括号中的值作为文本字段中的注释。示例:
String text = "I have simple annotation @Test(value123) and ..
我可以找到带有值的注释本身,但我不明白如何在没有注释的情况下获取它
Pattern patternString = Pattern.compile("@Test\\(\\s+\\)");
结果:
@Test(value123)
但我需要
值123
【问题讨论】:
-
显示您的代码。
-
你需要使用look behind/ahead or groups