× Exclamation Point Icon Important: As we continue to evolve and improve our offerings, we have decided to retire the SharpSpring Ads (formerly Perfect Audience) platform on August 15, 2024. Click here to learn more.
Home > Audiences > Website Audiences > Regular Expression Audiences

Regular Expression Audiences

Use the "regular expression" Retargeting Audience method to add people to an audience when the URL they visit matches a regular expression. This method is similar to the "Path" method but more complex, requiring knowledge of regular expressions. While "path" Audiences work great for 90% of use cases, like Querystring retargeting lists, sometimes you just need to use a regular expression (or "regex"). 


Scenario: Your company blog is located at "http://blog.sharpspring.com". You want to add people who visit the blog to a special Audience, but since the URL uses a subdomain rather than a subdirectory, you can't use the "path" method.

Solution: Create an "regular expression" Audience with target text of "blog\.sharpspring\.com". If the tracking tag is included on the site, when people visit it, they will be added to this new Audience.


Technical Details: Your regular expression will be tested against the entire URL your user visits. This differs from Google Analytics, but allows you maximum flexibility in creating your segments. You may use this feature to match protocol, subdomains, domains, paths, querystrings, and hashes (all the components of a URL). All regular expressions are executed with the case-insensitive flag set. To test your regular expression against the URLs you wish you match, we recommend using an online Javascript Regular Expression Matcher, like Scriptular. The text entered between the forward slashes on Scriptular should exactly match the text you enter in Perfect Audience.

Important: While we provide extensive support over e-mail for all aspects of SharpSpring Ads, we cannot teach you how to write regular expressions. If you need help with that, click here for a 3rd party tutorial.