URL regular expression

For more information about regex for Cloudlets, see Regular expressions with Cloudlets rules.

Description

Match on the fully qualified incoming request URL using regular expressions (regex). Regex uses a sequence of characters to define a search pattern. Regular expressions for Cloudlets use the RE2 library.

Depending on the Cloudlet, you can also use the information from capture groups in regex to form either the redirect URL, or the forward path/query string.

For example, if you are using regex with the Edge Redirector Cloudlet, you might use the following values:

Regex: (http|https)://www.(vanity|vanity1).com/(.*)
Redirect URL: \1://www.company.com/\2/\3
Test URL: https://www.vanity.com/item?name=value
Result: https://www.company.com/vanity/item?name=value

Cloudlets Supported

The following Cloudlets support this match type:

  • Audience Segmentation
  • Edge Redirector
  • Forward Rewrite
  • Input Validation

Fields

For this match type, you complete the following fields:

Name Description Example
Regular Expression (Regex) Enter a regex of up to 256 characters to match on the inbound URL, minus the port. (http|https)://www.(vanity|vanity1).com/(.*)
Redirect URL

(Edge Redirector Only)

For Edge Redirector, enter either:
  • the regex substitution pattern to create the modified URL, or

  • the URL to which you want send inbound URLs that match on the regex.

You must verify that the output URL is correct.

\1://www.company.com/\2/\3
Path and Query String

(Forward Rewrite Only)

For Forward Rewrite, enter either:
  • the regex substitution pattern to create the modified path and/or query string, or

  • the path/query string combination to which you want send inbound URLs that match on the regex.

You must verify that the output URL is correct.

/\1/\2
Note: Input Validation does not use capture groups. This Cloudlet uses regular expressions to validate form field entries in the incoming request.

Operators

This match type does not include operators.