Help Center

| Submit or View Help Requests | Developer Docs |
| |

Regex Explained

Regex (or Regular Expression) is a code that you can use to match text for a general case and is useful when matching promo codes. Regex is case-sensitive, so be sure to set your regex up in the case that matches your promo codes.

There are two main logic cases for regex and promo codes—starts with and ends with.

For this example, the base of our promo code is SUMMER.

Starts with

You’ve issued a range of summer promo codes to partners, SUMMER20OFF, SUMMER10, and SUMMER25. We want to match them all to credit our partners, how do we go about it? We would use the starts with logic. Simply add a period and a star at the end of your base promo code.

The regex should be exactly ^(SUMMER).*

This will automatically match any promo codes starting with SUMMER and ending with any other characters. Any codes not starting with SUMMER will not be matched.

Ends with

You’ve issued a range of summer promo codes to partners, 20OFFSUMMER, 10SUMMER, and 25SUMMER where the promo code always ends in SUMMER. How do we match them? We would use the ends with logic. Simply add a period and a star at the beginning of your base promo code and add a $ to specify the anchor of your string.

The regex should be exactly ^.*(SUMMER)$

This will automatically match any promo codes starting with other characters and ending with SUMMER. Any codes not ending with SUMMER will not be matched.

For more complicated expressions, please reach out to your CSM or contact support for help.

Note

You can remove regex case sensitivity by adding (?i) after ^ in your regex.

Example:

^(?i)(SUMMER).*

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.