Skip to main content
Text rule (policies)
Daniel Towers avatar
Written by Daniel Towers
Updated over a year ago

How to use the text rule in a policy

A text rule is a policy rule that allows you to match specific text on a webpage. You can use it to find instances of a particular word or phrase on your website.

1 - Choose text to match

The most common use of a text rule is to match specific text. For example, you might want to find all instances of the word "Silktide" on your website.

2 - Select the match type

You can choose to find either partial matches or whole word matches.

For instance, if you search for "test," it would be found in the word "testing" if you allow partial matches. However, if you select whole word matches, "test" would not be found in "testing."

3 - Set the match type

To find all matches, set the "Type" option to "Contains."

To match only whole words, select "Contains whole word."

4 - Case sensitivity

You can check the "Case sensitive" box if you want to match the text only if the case is identical.

For example, "Silktide" would not match "silktide" if case sensitivity is enabled.

5 - Use regular expressions

Advanced users can use regular expressions to implement more complex matching rules. Regular expressions are a small programming language designed to check and match text patterns.

To use a regular expression, set the "Type" option to "Regex", then enter the regular expression in the "Match" box.

If you're new to regular expressions, you can learn the basics of PCRE regular expressions here.

Did this answer your question?