User Tools

Site Tools


Spam Filter Rules: CountMatches

Statement CountMatches
Version 2.3.13+
Purpose Counts the number of times a specific regular expression matches in a string

CountMatches statements require a data parameter a search value and the name of the variable to place the count into, in the format

CountMatches <data> <search> <variable name>
  • The <data> paramater is defined in the documentation for IfMatch
  • The number of times the match occurs is returned into a variable with the name format ${<variable name>}


The following example will scan the body of the incoming message, for the regular expression '/ /' and return the number of matches into the ${numSpaces} variable

CountMatches body "/ /" numSpaces
reference/spamrules_statement_countmatches.txt · Last modified: 2018/11/14 10:45 (external edit)