A Regular Expression, REGEX, is a special text string for describing a search pattern. Within Hotjar, you can define a Regular Expression to target a specific string or pattern within URLs for all of our tools except for Forms, as well as block IP addresses.
For page targeting, when setting up your tool, there will be a Page Targeting option in which Regular Expressions can be set as the targeting option.
Need help building your Regular Expressions?
Regular Expression Examples
Below are the most common Regular Expressions used within Hotjar to help you get started. If you're unfamiliar with Regular Expressions, we highly recommend taking a quick crash course!
- Wildcard examples (where * can be anything)
- Wildcard excluding a certain pattern
- Excluding certain words or patterns in a URL
- Multiple pages which don't follow any pattern
Wildcard examples (where * can be anything)
Wildcard excluding a certain pattern
All pages which match the pattern but do not include the word "article" or "post" www.example.com/pages/*/subpage/
Excluding certain words or patterns in a URL
All pages which do not include "/somepage" and "/someotherpage"
Pages which include the word "page" and do not include "somepage":
Multiple pages which don't follow any pattern
Target these three pages: