Regular expressions with Cloudlets rules

Regular expression support

Some Cloudlets support the use of regular expressions in match rules. The regular expression can be up to 256 characters.

RE2 regular expression library

Cloudlets use the RE2 regular expressions library, which uses the finite-state machine (FSM) computational model and uses a C++ interface. Click https://github.com/google/re2/wiki/syntax, or go to a similar site, for information about RE2's syntax.

Cloudlets that support regular expressions

These Cloudlets support regular expressions in match rules:

Cloudlet Support provided
Audience Segmentation
  • use regular expressions to match on the fully-qualified URL of an incoming request.
  • use regular expression capture groups to form the forward path and query string.
Edge Redirector
  • use regular expressions to match on the fully-qualified URL of an incoming request.
  • use regular expression capture groups to form the redirect URL
Forward Rewrite
  • use regular expressions to match on the fully-qualified URL of an incoming request.
  • use regular expression capture groups to form the forward path and query string.
Input Validation
  • use regular expressions to match on the fully-qualified URL of an incoming request.
  • use regular expressions to match on form field names or values in the incoming request.

Valid characters

The following diagram shows the characters you can use for each part of the URL when creating a regular expression for Cloudlets.

Cloudlets Regex Example

Escaping special characters

If your regular expression includes any characters that have a special use in regular expressions (like “.”, “+”, or “?”), you must use a backslash (“\”) to escape each special character.