Regex Help
Learn some of the basics of Regex and how to use it to target dynamic URLs.
Table of Contents
Common Regex Patterns
Here is a little cheat sheet on a few common regex patterns
The most common regex pattern you will probably want is simply:
.+
The "." is the wildcard match, and the "+" means "match the previous item one or more times. Thus, ".+" means "match one or more of any character." So, the following pattern would work to match anything (say, a user's individual dashboard page) in a url:
/users/.+/dashboard
Note: while * is used as a wildcard inside flows and matches text the same as .+, it does not have the same use in Regex. When wanting a wildcard with Regex, you'll want to use .+ instead.
Here are some other common regular expressions that come in handy when using regex to target specific pages within Appcues:
- Any number: [0-9]+
- Either of two values: (Option1|Option2)
- Any word: [a-z]+
For even more help with Regex, check out this cheat sheet and this Regex tester.