As new spam campaigns emerge and existing ones change, it is important to be able to quickly update content rules.
Here’s an example of a rule that blocks any comments using a blacklisted keyword.
1 | CREATE RULE UsedBlacklistedKeyword WHERE patternMatches("BlacklistedKeywords.txt", Text); |
The patternMatches returns back an array of extracted matches or an empty array if none are found (empty arrays evaluate to false in SQRL). Often times you would want to use the extracted matches in the rule’s reason. We can easily do that by updating the code to the following.
1 | LET BlacklistedKeywordMatches := patternMatches("BlacklistedKeywords.txt", Text); |
This feature is also useful for maintaining blacklists, in this example of email addresses:
1 | LET BlacklistedEmailMatches := patternMatches("BlacklistedEmail.txt", ActorEmail); |