Learn how to exclude names from name validations using RegEx with a named capturing group.

Naming validation rules validate that the names in your ad platform adhere to a specific naming convention. When using the 'Use project taxonomy' feature, this convention is derived from an Output field from an Accutics Standardize project of your choice. 

For the validation to be successful, the names in the ad platform must match with the Output field you selected. However, this may be an issue if, besides the name, you also append extra information, e.g., IDs, codes, or any other values. 

To prevent this potential issue, the 'Exclude external values' filter allows you to define what matches with the Output field and hence, should be validated while excluding other irrelevant values. 

Hence, from the 'Use project taxonomy' settings of a naming validation rule: 

  1. 'Exclude external values'

  1. Input a RegEx reflecting the names in your ad platform
    1. Create a named capturing group (?P<output>pattern) that matches the selected Output field
    2. Define the values that should be excluded from the validation

  1. Test the validation 
    1. Paste in a sample name from your ad platform in the test field
    2. Verify the result

Define RegEx

A RegEx serves to determine which portion of the names in your ad platform should undergo validation while ignoring the rest. This involves expressing the RegEx with a named capturing group.  

Named capturing groups

A named capturing group is a specific capturing group that allows you to assign a name to it. This makes it easy to reference a specific matched portion of a string by name instead of index. 

In the context of this feature, the name 'output' is used to reference the part of your names that matches the Output fields you selected in the Naming conventions settings. This approach allows us to identify what should be validated and trim the remainder when executing a name validation rule. 

To define a named capturing group, simply use the syntax (?P<output>pattern). This is the part that must match the output taxonomy.


To ensure the correctness of your RegEx, you can test it by inputting a sample name from your ad platform and verifying that the result aligns with your intentions.

Copy and paste a sample name in the test string > 'Test'

In case of errors, the result field will indicate:

  • No output. The RegEx you entered yields no values. Review the RegEx or the sample name and try again.
  • Invalid RegEx. The RegEx you entered is not valid. Review the RegEx and try again.


Trim values after a unique character (e.g. #)

RegEx: (?P<output>.*)#.*

Test string: My campaign name#Creative id 21312

This RegEx captures 'My campaign name' and trims everything after the delimiter '#'.

Trim values before a set of characters that need to be escaped (e.g. ++)

Some characters have specific meanings when constructing a regex, and need to be escaped with a backslash (\).

RegEx: .*\+\+(?P<output>.*)

Test string: Awareness++My campaign name

This RegEx captures 'My campaign name' and trims everything before the delimiter '++'.

Trim values in between a set of characters

RegEx: .*#(?P<output>.*)#.*

Test string: Awareness#My campaign name#ID216543

This RegEx captures 'My campaign name' and trims everything before the leading delimiter '#' and after the trailing delimiter '#'.

Trim values after the nth character (e.g. validate the first 4 values using the delimiter)

Some outputs might have the same structure for delimiters, where trimming before or after a unique character is possible. You can define how the output is structured and thereby exclude everything else.

RegEx: (?P<output>[^_]*_[^_]*_[^_]*_[^_]*)

Test string: Awareness_Social_Facebook_2024_black friday

This RegEx captures 'Awareness_Social_Facebook_2024' and trims everything after the 4th value that uses _ as delimiter.