I'm new here and I'm also a beginner in regex.
I'm using Reqtify to match and capture Requirements from a PDF file.
Here the example of the file content:
**Requirement1**
Text of the first requirement bla bla
Second line of the first requirement.
**Requirement2**
Text of the second requirement, no second line
**Heading 2[Distributed]**
**Requirement3**
Text of the third requirement
Second line of the third requirement
Third line of the third requirement
**Heading 1[Distributed]**
**Requirement4**
Text of the 4th requirement
Second line of the 4th requirement
Third line of the 4th requirement
**Heading3[Distributed]**
[...]
Here what i want for the Requirement3 for example :
Text of the third requirement
Second line of the third requirement
Third line of the third requirement
As can you see the file mixes requirements and different heading (1,2,3 etc).
My first idea was to capture each requirement until the line which ends with *"]".
So my regex pattern is:
(^Requirement\d+).*$\n(\s\S]*?)^.*Distributed\]$
But it doesn't work well (see picture below).
My second idea is to have different end of the multiline, something like this:
(^Requirement\d+).*$\n(\s\S]*?)**^.*Distributed\]$|^Heading\d+**
But it doesn't work at all, i know that the regex syntax isn't right.
Can someone, please, help with the two ideas?
Thank you for your time.
Also, if you have documentation about regex in Reqtify I would love to read it.
PS: I use regex101 to test my expression.
Thank to @GreyMurav I can capture what I want. However I noticed that in the file, in each page there are a header and a footer, so in some requirement they are captured.
The header its like this :
'#TABLE
'#TR|1 bla bla bla bla
'#TR[1...................... Distributed|5 page 5/102
SO you can have something like this : Requirements 5
First line of the requirement
*#TABLE
#TR|1 bla bla bla bla
#TR[1...................... Distributed|5 page 5/102*
The rest of the requirement bla bla.
Here what I tried :
- add a non-capturing group ''' (?:^#TABLE\nTR.*\n#TR.Distributed.$) ''' I tried to place it everywhere but It doesnt work.
- In Reqtify you can apply a sub-exopression to a group. But it doesn't work eather.
How can I solve this problem?
Thank you for your time.
