Gearset's customizable filters let you control the types of metadata that are displayed in your comparison results. To add an additional layer or granularity, you can use regex filtering to include or exclude specific named items.
You can use Regex filtering to either include or exclude items from your comparison results. In this article we'll demonstrate how to use this powerful feature to tune your custom filters.
Switching to named items
First, find the metadata type you're after from the left-hand list, and switch the toggle to Named items.
You should note that when you switch to Named items, no items are included by default. You can select specific items to include in your filter and subsequent comparison either using the checkboxes or by adding regex.
Including items based on regex
Imagine you want to include all items that begin with
Site. Rather than selecting every item manually, you can add a regex rule to include all matching items. Select Regular expression from the dropdown and type the regex pattern
^Site.* into the text field. Click Add to save the rule.
Excluding items based on regex
Sets of items can be excluded by a regex pattern in much the same way as they are included above, by selecting the exclude option on the right hand drop down when Regular expression is selected on the left.
The key difference with exclude regex is that items that match the pattern are excluded no matter what, regardless of whether they were included individually or via regex pattern. Exclude regex takes priority over any other filters.
Consider the below example:
The include regex will find
TopicAssignment , in addition to the explicitly included
StreamActivityAccess , and
User . However, the exclude regex will match
TopicAssignment , and
As a result, the final set of objects to be included in the comparison will be
Building a complex filter with includes and excludes
Include and exclude filters can be layered to create complex metadata filters.
Take the first example in this doc, including
Site items. Imagine you want to exclude
SitePoweredBy from the comparison, but include all other Apex components.
Select Object name from the dropdown, type the name of the item you want to exclude, and switch the right most dropdown to Exclude. Hit Add to save the rule.
If you left things there,
SitePoweredBy would be excluded, but so would every other Apex component! Now you would need to add the include regex term
.* which includes all other items of this metadata type.
Using these filters you can build up complex metadata filters to fine tune your comparisons and control exactly which items you want to compare and deploy.