Named capture groups

The URL Regular Expression match for Cloudlets supports a maximum of nine numbered substitutions using capture groups.

When using named capture groups, use the following syntax before the regular expression (regex): (?P<name>regex). As the RE2 library supports named capture groups as numbered substitutions, use \n for the substitution string.

Remember that the maximum size of a regular expression is 256 characters.

Here's how a regex for Edge Redirector would look using both capture group methods:

Capture Group Type Syntax
Numbered Capture Group
  • Regex: (http|https)://www.(vanity|vanity1).com/(.*)
  • Redirect URL: \1://\2/\3
Named Capture Group
  • Regex: (?P<Proto>http|https)://www.(?P<Vanity>vanity|vanity1).com/(?P<Path>.*)
  • Redirect URL: \1://\2/\3