Rule Operators

Page Type
Meta Title
Meta Description
Category
HTTP Rules (Modify Traffic)
Publish
Publish
Path
/http-rules/rule-operators
ย 

Rule Operators

When you create a modification rule, you will find the following operators:
  • Equals
  • Contains
  • Matches (Regex)
  • Matches (Wildcard)
Lets understand the use cases for each.
notion image

Equals Operator

Equals operator does strict matching of URL intercepted by the browser with the URL given in rule.

Example

URL given in rule:ย http://www.google.com Intercepted URL:ย http://www.google.com/ย (Observe trailing slash) Result: โŒ Does not match

Reason

Note a trailingย /ย slash at the end of URL. A rule withย Equalsย operator and URL asย www.example.comย does notย matchย www.example.com/. You may consider adding Slash (/) at the end of URL in your rule. You can alternatively create two pairs in the same rule as well.

Contains Operator

Contains operator does a substring search of string provided in rule inside the URL intercepted by chrome.

Example 1

String in rule: yahoo Intercepted URL:ย https://www.yahoo.com/ Result: โœ… Match

Example 2

String in rule: com?a=1 Intercepted URL:ย https://www.got.com?a=2 Result: โŒ Does not match

Reason

com?a=1ย is not a substring of a URL and hence it does not match.

RegEx Match Operator

Regex Match Operator matches a given Regex with the URL intercepted by chrome.
You can also use the values ofย group expressions in your destination URLs.

Example

URL Matches (Regex): /(.+).google/ig Destination: https://$1.google.com Result: โœ… Match

Reason

In this case, above regex will be matched with intercepted URL. If regex is matched then $1 will be replaced in the destination URL and redirect will happen.

Wildcard Match Operator

Wildcard match operator matches expression with the URL intercepted by chrome.
We only support asterisk (*) as wildcard operator.ย *ย can matchย 0 or more charactersย in intercepted url.
๐Ÿ’ก
Caution In wildcard match, complete URL is matched with given expression andย \*ย can be replaced with respective values in destination URL.

Example 1

Expression:ย *://*.yahoo.com URL:ย http://cricket.yahoo.com Result: $1 = http, $2 = cricket

Example 2

Expression:ย *yahoo URL:ย http://www.yahoo.comย (Note the trails does not match ieย .com) Result: โŒ Does not match

Example 3

Expression:ย *yahoo* URL:ย http://www.yahoo.com Result: $1 =ย http://www.ย $2=.com

Example 4

Expression: http://*.yahoo.com URL:ย http://cricket.yahoo.com/ย (Note the trailingย /ย slash in URL) Result: โŒ Does not match
ย