0

I have a string like this

1) /* This is the Start for the Test : 1 */
2) Lu8_Ret = GetStatus_1();
3) Lu8_Ret = Lu8_Ret + 1;
4)/* This is the End for the Test : 1 */
5)
6) /* This is the Start for the Test : 2 */
7) Lu8_Ret = GetStatus_2();
8) Lu8_Ret = Lu8_Ret + 1;
9) /* This is the End for the Test : 2 */
10) 
11) /* This is the Start for the Test : 1 */
12) Lu8_Ret = GetStatus_1();
13) /* This is the End for the Test : 1 */

By using following regular expression I am reading the content between the start and end comment lines

regex = r"This is the Start for the Test : 1(([\S\s])*) This is the End for the Test : 1"
for match in re.finditer(newrx, content):
    print(match.group(1))

But it's giving the content between the start comment of Test: 1 to last end comment of Test: 1(line number 2 to 12).

How to get the content as a separate group (from line 2-3 as one group and line 12 as another group)? (My program will take care of unwanted /* , */ )

goodman
  • 424
  • 8
  • 24

0 Answers0