如何使用宏从QC获取发布的需求总数

时间:2013-08-06 16:29:06

标签: vba

我想检索release.PFB的需求总数示例:

Release 1:
 Code Drop 1
   Req 1
   Req 2
   Req 3
   Req 4
   Req 5
 Code Drop 2
   Req 1
   Req 2
   Req 3
   Req 4

我想以下列格式检索需求总数:

Release 1      No of Req
Code Drop 1    5
Code Drop 2    4
Total          9

1 个答案:

答案 0 :(得分:0)

假设这是一个长字符串,您可以使用正则表达式。首先使用pattern获取一组Code Drop部分:

Code Drop.+(?=Code Drop)

然后,对于这些部分中的每一部分,都会找到Code Drop本身:

Code Drop \d+

并且“Req”的数量与另一种模式匹配:

Req \d+

这是在VBA中使用正则表达式的tutorial