【发布时间】:2016-05-20 05:17:32
【问题描述】:
当我pull the annotations of a method in Java class 时,我收到以下String 响应:
@client.test.annotations.TestInfo(id=[C10137])
@org.testng.annotations.Test(alwaysRun=false, expectedExceptions=[]..
但是,我只对 id=[C10137] 部分感兴趣,并希望获得该号码 - 10137。也可以是这样的情况:
案例1: //multiple ids
@client.test.annotations.TestInfo(id=[C10137, C12121])
@org.testng.annotations.Test(alwaysRun=true,...
案例2: //no id
@client.test.annotations.TestInfo(id=[]) //ignore this time
@org.testng.annotations.Test(alwaysRun=true,...
这里的正则表达式会为我工作以生成这个 id 数组吗?或其他一些获得所需 id 数组的好方法。
【问题讨论】:
标签: java regex annotations pattern-matching text-processing