This criteria lets you match based on a regular expression against a string. You can use it to flexibly apply behaviors depending on the contents of dynamic variables.
In the Match String field, enter a string – typically a dynamic variable, such as a built-in variable like
AK_HOST or a user-defined
In the Regex field, enter a Perl Compatible Regular Expression (PCRE) to match against the string. Note that while you can specify grouping subexpressions using parentheses, you cannot extract variables from the Match String.
Also, specify if the regular expression match should be case-insensitive – this applies to the entire Regex string match. See the second example below for more information.
Match the incoming hostname (stored in the
AK_HOSTvariable) against a set of allowed hosts, all of which contain any of
deveither preceded or followed by a dash (or both) somewhere in the hostname:
In this example, it would match against any of the following hostnames (assuming that they are defined in the configuration):
But it would not match against any of the following hostnames:
exampledev7.com– no dash preceding/following
Match the request path (stored in the
AK_PATHvariable) to ensure that it has a format of an “apps” path segment followed by a path segment consisting of a letter (upper or lower case) followed by 3 to 5 digits, and then a “user” path segment optionally followed by further path segments:
In this example, it would match against any of the following paths:
But it would not match against the following paths:
/apps/a12/user– only two digits in the 2nd path segment
/apps/98765/user/coolstuff/abc– no leading letter in the 2nd path segment
If you want to allow any upper- or lower-case characters in the above paths (e.g. you want to allow
/APPS/a1234/User), you could specify Case Sensitive as Off.
A useful Regular Expression reference and test site is Regex101 PCRE.
Note that this is not an Akamai site.
Please note, any external link(s) to other site(s) outside of the Akamai.com domain, are being provided only for convenience and informational purposes; and Akamai bears no responsibility for the accuracy, legality or content of such external site(s) or such external link(s).
Regular expression matches are relatively "expensive" in terms of CPU usage and should be avoided unless there is realistically no other way to perform the same match. For instance, the first example above could probably be replaced with a Hostname match, unless the configuration includes hundreds of possibly-matching hostnames.
If a Regex match is used together with any other matches in the same rule as Match All, the other matches should be specified first, to avoid the "expensive" Regex match being invoked if any of the other matches do not evaluate to true.
Updated 8 months ago