<@U07FJ89LFFB> is there a way to use regex in URLs...
# ask-ai
w
@brash-pillow-71627 is there a way to use regex in URLs for redirect tests?
o
A message from kapa.ai
Yes, GrowthBook supports the use of regular expressions (regex) in URL targeting. This can be particularly useful when creating visual experiments. For example, you can write a full regular expression for URLs like this:
Copy code
regex https?:\/\/(www\.)?example\.com\/pricing\/?
Or you can match just the path:
Copy code
regex ^\/pricing\/(pro|enterprise)
However, writing regular expressions for URLs can be error-prone, so it's important to be careful and make sure to escape all special characters that you don't want to be interpreted. As for redirect tests, GrowthBook allows you to specify an "Original URL" and "Destination URLs" for each of your variations. When a user visits the Original URL and is included in the experiment, they will be assigned a variation and then redirected to the destination URL. However, the documentation does not explicitly mention the use of regex in these URLs for redirect tests. For more details, you can refer to the [GrowthBook documentation on Visual Editor](https://docs.growthbook.io/app/visual#regex-targeting) and [URL Redirect Testing](https://docs.growthbook.io/app/url-redirects).