OptinMonster Documentation

Documentation, Reference Materials, and Tutorials for OptinMonster

Home

Docs

How to Use OptinMonster’s Matching The Pattern RegEx Rules

How to Use OptinMonster’s Matching The Pattern RegEx Rules

OptinMonster makes it easy to target campaigns to URLs matching a pattern or RegEx using our Display Rules.

In this article, you’ll learn how to show or hide your campaigns using pattern matching or RegEx on your site.

Before You Start

Here are some things to know before you begin:

  • “Matches the pattern” is an option available with some Display Rules in the campaign builder to provide you with more advanced functionality for hiding and showing campaigns on your site.
  • This feature allows you to use RegEx (Regular Expression). RegEx looks for characters: be it letters, numbers, or specific symbols to identify a pattern.
  • Because RegEx engines evaluate “patterns of characters”, OptinMonster has employed the phrase, “matches the pattern” because it is a more easily recognizable phrase to describe what is occurring.

Using “Matches the Pattern”

You can use “matches the pattern” with the following Display Rules when editing your campaigns:

To use RegEx in your campaign’s Display Rules, follow these steps:

  1. Navigate to the Display Rules view in the campaign builder.
    Navigate to the Display Rules in the OptinMonster campaign builder.
  2. When adding a Display Rule that supports pattern matching, select matches the pattern from the operator dropdown and your RegEx into the text field.
    Matches the pattern operator in the OptinMonster campaign builder.
  3. When you’re finished, Save the campaign.

Examples

The following are some examples of RegEx pattern matching you could use with your campaigns.

Exclude the campaign from Showing on Multiple Language Directories

Let’s say your default language is English for your site, so that site shows on mysite.com while your other sites load on URL paths like: mysite.com/es/ or mysite.com/de/ or similar language structures, etc.

In this case, you do not want your campaign to load on those other languages. Therefore, you could enter in a slightly more complex RegEx pattern to prevent the campaign from loading on pages that start with those certain language pre-fixes:

In the situation where you have the following languages: es, de, ja, and ru, you could use the current URL path rule and set the following RegEx Pattern (“Matching the Pattern”):

^(?!(es|de|ja|ru)/?).+

The above will prevent a campaign from showing on pages where the url path (the part after the .com) begins with:

  • es/
  • de/
  • ja/
  • ru/

Essentially, the campaign would only show here: mysite.com and related English pages, but never the pages of those other languages.

Troubleshooting

Is there a simpler way to target my campaigns?

Some pre-made RegEx Rules are already natively built into OptinMonster’s Display Rules. You can try to use those pre-made rules such as “Contains”, “Does Not Contain”, “Starts With”, “Ends With”, etc., before attempting to use this advanced approach.

Do you have any resources to help me with using and testing RegEx pattern matching?

We have found the following sites helpful for using and testing out RegEx.

When creating your pattern to use in OptinMonster, we strongly suggest using the sites listed above to test the pattern before adding it to your campaign. This will help speed up testing for your campaign.


Still stuck?

How can we help?

Last updated on


Start Getting More Leads & Sales Today with OptinMonster!

Start Getting More
Leads & Sales Today
with OptinMonster!

Create and launch smart capture forms today in minutes. What are you waiting for?

Create and launch smart capture forms
today in minutes. What are you waiting for?

OptinMonster has transformed our business. Before integrating their optins, our clients saw a 2% conversion rate from web traffic, which is slightly above the standard for their industry. With the integration of OptinMonster’s lightbox popup, exit-intent technology, split testing, and other tools, our client’s conversion rates soared by an unprecedented 500%. They attracted substantially more customers while spending less on digital advertising. Their success propelled them to the top of their markets, outperforming national chains and other medical spas with much bigger marketing budgets. Our client’s success in their market has distinguished us in our own. We are now one of the most sought-after marketing firms in the industry of aesthetic medicine. We know that the integration of OptinMonster, more than any other tool or marketing strategy, has supported this growth and achievement.

chris zelig medstar media

Chris Zelig

Partner, Medstar Media

OptinMonster has been a game-changer for us. From driving donations to collecting new leads, there is nothing that this simple tool has failed to accomplish. Our lead collection rate has jumped by over 1,000%.

joe lowe american bird conservancy

Joe Lowe

Director of Digital Communications, American Bird Conservancy

Through OptinMonster’s exit-intent popups, we have more than doubled our sales conversion rate. Best of all is the compound effect of using OptinMonster over a long period of time—more conversions mean more customers, which means more word of mouth.

mitch smith, managing director, shockbyte

Mitch Smith

Managing Director, Shockbyte.com