Testing Exclusions

<< Click to Display Table of Contents >>

RayPack > 7.3 u6 > User Guide > Settings > Repackaging > Exclusions Editor 

Testing Exclusions

Using the Regular Expression Editor / Tester

The editor shows the content of the currently edited row, showing each allowed customizable value as a separate tab. Depending on the type of the object being edited (registry, file, folder, environment variable or service) different tabs may be available. For example, the rule for a registry entry contains customizable:

 

Location (denoting the key)

Name (denoting the name of the value)

Value

 

EditExclusionListsExpressionEditor

 

If any of these is left blank, it means that all values will match. For example, leaving the NAME blank would mean that all entries that match the LOCATION and VALUE are matching the whole rule.

 

Each tab is subdivided into two section:

 

An expression editor

An expression tester (hidden by default)

 

The expression editor is the field containing the regular expression used to match the excluded/included resource. The field has to contain a valid regular expression. Entering invalid value here would ignore the whole rule when the delta is generated from the captured resources.

 

In order to make sure that the regular expression is valid, a small indicator is shown under the expression field. It validates the typed input as it is being typed, it is being typed,pe, providing immediate feedback whether the rule is a valid regular expression or not.

 

For example the following expressions are valid:

^(?i)(HKEY_LOCAL_MACHINE|HKEY_CURRENT_USER)\\Software\\Microsoft\\Windows\\CurrentVersion\\(Installer|Uninstall|Setup)

Logging

(File|Folder)A

 

Test the Patterns

Once the regular expression is valid and understandable by the RegExp engine, it is always a good idea to make sure that the rule can be actually used to find a certain string/pattern.

 

For example, the following expression:

%UserProfile%\\MyFolder

is a valid regular expression, but the following resources will not match the rule:

 

1.%USERPROFILE%\MyFolder

2.%USERPROFILE%\YourFolder

3.C:\Users\HardcodedUserName\MyFolder

 

The problem with the test string number 1 is a different casing. By default, all regular expression must match the casing of the tested string. A solution would be to add the (?i) bit at the beginning of the regular expression to match the test string regardless of the casing. The correct rule would be:

(?i)%UserProfile%\\MyFolder

 

The problem with the test string number 2 is that it simply points to another folder. If that folder has to be also excluded, the rule has to be adjusted:

(?i)%UserProfile%\\(My|Your)Folder

 

The problem with the test string number 3 is similar as the string number 2. One important difference is in the usage of environment variable in the expression string and an absolute path in the test string. During application of the exclusion lists, environment variables in the test string are resolved so that the full path will be matched. The regular expression tester can be used on different machines than the actual repackaging so that it does not resolve any variables. Therefore, the test result will be false, although it may actually return true when HardcodedUserName is installing the package and applying the exclusions filters.

 

In order to make sure that HardcodedUserName folder is always excluded, the solution is to add a new rule that will capture MyFolder using the full path. For example:

(?i)C:\\Users\\([^\\)\\MyFolder

 

Determining such issues during repackaging may be problematic and time consuming. A better solution is to always test the expression against desired results when the exclusion lists are built.

To Test the Pattern Against the Test String

1.Type the regular expression into the expression field.
 
Make sure that the expression is valid (the indicator below the text field should display the VALID badge).
 

2.Click the toggle button Test expression under the expression editor.
The test field is displayed.
 

3.Enter the desired string into the new text field. RayPack will evaluate whether the expression is matching the specified string.
 

4.If the status displayed under the tester shows NOT MATCHING, it means that the regular expression is valid, but was not found in the test string.
 
That also means that when the delta engine evaluates a specified string during applying the exclusion filters, a given string will not match the exclusion rule.
 

5.If the status displayed under the tester shows MATCHING, it means that the regular expression is valid and was found in the test string.
 
This means that when the delta engine evaluates a specified string during applying the exclusion filters, a given string will match the exclusion rule.