How Can I Test Regular Expressions in Requirements Gateway?

Updated May 15, 2023



  • Requirements Gateway

I am modifying a Requirements Gateway type, and I am having trouble writing the correct regular expressions.  How can I quickly test my regular expressions to speed development of my custom type?

You can test regular expressions using the Expressions pane, located in the Configuration Dialog. To test regular expressions, follow the instructions below:
  1. On the Expressions pane, enter project document source file text to use for testing the expression in the Text analysis control. You can also use the following options in the File menu on the Expressions pane to import text from an existing project document source file:
    1. Import file—Imports text from a project document source file for a text-based type, such as a Microsoft Word document, and converts the file to a temporary intermediate file for testing. 

      In order to test your regular expressions for a type that does not support text-based documents, such as LabVIEW or TestStand, you will need to save a copy of the intermediate file used by the type. To create a copy of the intermediate file on disk, enable the Intermediate file option for your document in the Project pane of the Configuration Window. With this option selected, Requirements Gateway will place the intermediate file in a folder called intermediate when you analyze the project. This folder is located in the current project directory.  You can then use the Import intermediate file option in the Expressions pane to import the text for testing:

      Note: with the intermediate file option selected, modifying the source file will have no effect on the analysis, since Requirements Gateway will not overwrite an existing intermediate file.  After modifying a source file, you must either deselect the Intermediate file option or delete the intermediate file on disk.
    2. Import directory—Imports text from multiple project document source files located in the same directory and converts all the files to a single temporary intermediate file for testing. 
    3. Import intermediate file—Imports text from an existing intermediate file for testing.
  2. Enter a regular expression in the Regular expression control and, if necessary, a sub-regular expression in the Sub expression control. 
  3. Click the Test regular expression button.  If there are matches to the expression, they will be displayed in a table.
The Expressions pane also displays the values for any groups you have specified in the regular expression using parenthases. The Text field displays the text of the line containing the match, as shown in the image below: