Using regex to filter comparison results
Ali Daw avatar
Written by Ali Daw
Updated over a week ago

With Gearset, you choose a metadata filter before running a comparison, which determines the metadata that's retrieved for the comparison results grid. You can choose from standard filters, or create a custom filter. In a custom filter, you can use regex. For a detailed guide on how to do this, see this separate support article.

However, there are some cases where you may want to filter the results after a comparison. You can use the global search in the top-right to filter by text, or use the filtering in the Metadata type column to select a particular metadata type, for example. Sometimes, a fine-grained filter might be required, such as hiding some fields based on their name — which is something you can do using regex filters.

In this example, there's a custom object called RegexExample that exists in the source and target. The source object has some fields that don't exist in the target. These fields are:

  • Quantity

  • TEST_AccountNumber

  • TEST_Price

  • TEST_Quantity

We're going to filter based on the names of the metadata items.

To start, click on the menu icon at the top of the Name column:

Filter results by text

If we want to include items based on text in the name, e.g. to only show items with TEST included in their name, we can simply enter that in the box. (This filtering is not case-sensitive, so typing in TEST and test gives the same results.)

Now, only items with names including TEST are included in the results:

Filter results by regex

Tick the box Use regular expression to enable regex mode:

Note that ticking the box to enable regex mode makes the filter case-sensitive.

For example, if we only wanted to see items that did not include TEST in their name, we could use the regex expression ^((?!TEST).)*$ to exclude:

Now, only fields with names not including TEST are shown in the comparison results:

To use several filters together, combine them with the | operator, e.g.
TEST|Quantity will match on either word:

Did this answer your question?