LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

requirements gateway & regular expressions

I'm trying to create a regular expression that will match a Requirement ID type in a MS Word document using Requirements Gateway.

Our syntax for a Requirement ID is as follows:
    '* shall [::requirement id] *'

An example would be
    'The system shall [::requirement1] self destruct after 1 minute of use.'

I'm using the following RE.

    shall[ \t]*\[[ \t]*(.*)::(.+)\]

I've been able to get it to match 'most' of Requirement ID's ,but a few aren't caught...most noteably those Requirement ID's that run past the end of the line.

When 'shall' is on one line and '[::requirement1]' is on the next, the Requirement ID isn't matched.

Are there any limitations to the RE engine that Requirements Gateway uses?

If not, any help with the RE would be MUCH appreciated.


thanks

Pat


0 Kudos
Message 1 of 8
(3,721 Views)
Pat,

The only way I was able to reproduce this problem was to have a return between the shall and the Requirement ID.  In the Project Configuration, you can enable the "Intermediate File" checkbox to show the file that is being created from Word.  The NIRG Parser only parses one line at a time.  If you do not have a hard return (but it line-wraps to a new line), this is still treated as a single line.  However, if you place a return inside of the text, NIRG will treat this as two lines.  If this does not help you, could you post a sample Word document along with the custom Type you created?  It should be located in the same directory as your project file with the same name as the project, but with the .types extension.

Allen P.
NI
0 Kudos
Message 2 of 8
(3,707 Views)
Allen,

Thanks for the advice.  Unfortunately it didn't help 😞

Again, our requirements are identified by a 'shall' followed by a tag in brackets. 

Ie  The unit shall [<optional source>::requirement id] be expensive.

The RE, "shall\[(.*)::(.+)\]" doesn't always work. (Sorry for the embedded emoticon)

Most of the time it identifies the tag but says
Requirement ' : XYZ' can't be covered.
Error: Requirement defined several times

Other times is combines two tags into one.


I'm attaching the modifed type and the doc thats causing the problems.


Thanks for your continued help,

Pat
0 Kudos
Message 3 of 8
(3,658 Views)
Pat,

It looks like the file was not attached.  Try putting the files in a zip file and uploading them.

Allen P.
NI
0 Kudos
Message 4 of 8
(3,649 Views)
I'm having problems attaching the zip file.  I tried yesterday and wasn't successful.  I'll try again...


Pat
0 Kudos
Message 5 of 8
(3,625 Views)
Pat, I have found the problem with the regular expression used.  Change the regular expression to the following: shall \ [ ( ? : . * ) : : ( . + ) \ ]

(I added an extra space to avoid having smiley faces in the expression.)

 You can remove all the spaces in the expression. By adding the extra ?:, you are instructing NIRG to ignore the first grouping. Since there may be additional text before the colons that we do not care about, prefixing it with a ?: will throw it away. The next grouping contains the correct information.

Allen P.
NI

Message Edited by AllenP on 05-03-2007 03:06 PM

0 Kudos
Message 6 of 8
(3,612 Views)
Allen,

Thanks so much.  Unfortunately, it doesn't match two of the 15 (Items 9 & 12).  It looks like if two 'requirements' are in the same table element, it matches only the second.  I looked at the raw text and the only thing I see different is the absence of a hard line feed between the two sentence.  Would that cause this problem.  How would I modify the RE to prevent that?

Also,  Is there a specific RE standard the the NI RE engine adheres too?


Again,  thanks for your help,

Pat
0 Kudos
Message 7 of 8
(3,604 Views)
Pat,

You will need to enabled the "Tab cells folding" option on your type.  Go to the "MyWord" custom type you created.  You will see a checkbox that will allow you to select this option.

NIRG uses the same regular expression pattern matching using the same syntax and semantics as Perl.

Allen P.
NI
0 Kudos
Message 8 of 8
(3,579 Views)