Use Regular Expressions


In certain sections of the CAST Delivery Manager Tool, you can use Regular Expressions to filter, exclude and ignore certain items.

For example, when adding a Source package for Folder based source code, it is possible to specify which folders and files you want the CAST Delivery Manager Tool to ignore during the Packaging process:

The following is an explanation of the Regular Expression system used by the CAST Delivery Manager Tool and some examples of how to use it.

System in use

The CAST Delivery Manager Tool uses the Java Regular Expression system - you can find out more about this here: http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html

Dialog box

When you want to add in a new Regular Expression, the following dialog box will be displayed:

Regular expression Enter your Regular Expression here. Some examples are given below:
String searched Regular expression to enter
Strings containing "src" src
Strings exactly matching "src" ^src$
Strings starting with "src" ^src
Strings ending with "src" src$
A sub-folder exactly matching "src" /src$
A sub-folder exactly matching ".src" /\.src$
All files stored in a sub-folder exactly matching "src" /src/

Number of characters

You can enter a Regular Expression of up to 500 characters.

String matching

Please note that by default the CAST Delivery Manager Tool matches only part of the string corresponding to the Regular Expression you have entered, rather than the entire string. As such to match an entire string please use the ^ and $ characters around the required string.

Reserved characters

Please note that the following characters are "reserved characters" and therefore must be "escaped" with a backslash before being used in a Regular Expression:

. ( ) [ ] ^ $

So, for example to match for an item (a folder in this case) entitled ComplexityVolume(PercentageofLOC), you will need to enter ^ComplexityVolume\(PercentageofLOC\) in the Regular expression field.

Please see the section entitled "Backslashes, escapes, and quoting" in http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html for more information.

Invalid Regular Expressions

The Package option will fail if you have entered a malformed Regular Expression. Please use the Test string and Test result options below to test your Regular Expression before you use it.

Case sensitive Tick this checkbox if you would like the Regular Expression to function in case sensitive mode.
Test string Use this option to check whether the Regular Expression you have entered will match the string you require. Enter the string you wish to match in this field.

Click the Check option to run the test. Results are displayed in the Test result field.

Test result This field displays the result of the check carried out using the string entered in the Test string field.

CAST Website