Writing Compliance Rules

The system uses a powerful rule engine to scan text content for specific keywords and phrases. You can define rules using boolean logic to create precise and flexible matching criteria. This guide explains the syntax for writing these rules.

Core Concepts

1. Patterns

The most basic component of a rule is a pattern. A pattern is any word or phrase you want to search for.

  • Patterns must be enclosed in double quotes (").
  • Matching is case-insensitive. The rule "Free Money" will match "free money", "Free Money", and "FREE MONEY".
  • Patterns can contain any characters, including spaces and punctuation.

Example: To find the exact phrase "satisfaction guaranteed", you would use the following pattern:

"satisfaction guaranteed"

2. Operators

Operators allow you to combine multiple patterns to create more complex logic. The engine supports AND, OR, and NOT.

AND

The AND operator requires that both patterns exist in the content.

  • Proximity Rule: For an AND condition to be met, the matched patterns must be located within 300 characters of each other in the text.

Example: This rule will only match if the phrases "lose weight" and "fast" are found close to each other.

"lose weight" AND "fast"
  • Matches: "You will lose weight fast with our new program!"
  • Does NOT Match: "You can lose weight. ... (500 characters later) ... Our program is very fast."

OR

The OR operator requires that at least one of the patterns exists in the content. Proximity is not a factor for OR.

Example: This rule will match if either "all-natural" or "organic" is found.

"all-natural" OR "organic"
  • Matches: "Our new product is all-natural."
  • Matches: "We only use organic ingredients."
  • Matches: "Our new all-natural product uses organic ingredients."

NOT

The NOT operator creates a negative condition. The rule will only match if the specified pattern is not found in the content.

Example: This rule will match any content that does not contain the phrase "side effects".

NOT "side effects"

When used with other operators, it can exclude content that would otherwise match.

"acme product" AND NOT "side effects"

This rule matches content that mentions "acme product" but only if it does not also mention "side effects".

3. Grouping with Parentheses

You can use parentheses () to group expressions and control the order of evaluation, just like in mathematics. This is essential for building complex rules.

Example: Imagine you want to find content that mentions "cures" or "treats" a disease, but you want to exclude any content that also mentions it's "not a medical claim".

("cures" OR "treats") AND NOT "not a medical claim"
  • The OR condition inside the parentheses is evaluated first. The rule looks for either "cures" or "treats".
  • Then, the AND NOT condition is applied. The content will only match if it contains one of the first two patterns and does not contain the exclusion phrase.

Rule Examples

Here is a table of examples ranging from simple to complex.

Rule Description
"free trial" Matches content containing the exact phrase "free trial".
NOT "contract" Matches content that does not contain the word "contract".
"money back" AND "guarantee" Matches if both "money back" and "guarantee" appear within 300 characters of each other.
"shipping" OR "delivery" Matches if either "shipping" or "delivery" (or both) are present.
("risk-free" OR "no obligation") AND "sign up" Matches if "sign up" appears in proximity to either "risk-free" or "no obligation".
("miracle" OR "wonder drug") AND NOT ("parody" OR "satire") Finds mentions of "miracle" or "wonder drug" but excludes content that is likely a parody by also mentioning "parody" or "satire".
NOT ("FDA" OR "Federal Drug Administration") Excludes any content that mentions the FDA using either its acronym or full name.