User Tools

Site Tools


reference:spamrules_statement_ifmatch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
reference:spamrules_statement_ifmatch [2011/08/22 14:38] simonreference:spamrules_statement_ifmatch [2018/11/14 10:45] (current) – external edit 127.0.0.1
Line 6: Line 6:
 **IfMatch** statements require a data parameter and a search value, in the format **IfMatch** statements require a data parameter and a search value, in the format
   IfMatch <data> <search>   IfMatch <data> <search>
 +
 +The **IfMatch** statement must be terminated with an **EndIf** and may contain an **Else** statement, just like the [[spamrules_statement_if|If]] statement.
  
 =====Data===== =====Data=====
Line 30: Line 32:
 ^whitelist  |This allows you to see if the search text is in the spam whitelist |2.1.7 | ^whitelist  |This allows you to see if the search text is in the spam whitelist |2.1.7 |
 ^blacklist  |This allows you to see if the search text is in the spam blacklist |2.1.7 | ^blacklist  |This allows you to see if the search text is in the spam blacklist |2.1.7 |
-^''<headername>''  |This lets you search a specific field in the message header. Any header name can be used. Any MIME encoded header lines will be decoded before searching them. |2.1.7 | +^''<headername>''  |This lets you search a specific field in the message header. Any header name can be used. Any MIME encoded header lines will be decoded before searching them. The header name should be typed without the angle brackets (<>).|2.1.7 | 
-^Raw-''<headername>''  |This lets you search a specific field in the message header. Any header name can be used. MIME encoded header lines will not be decoded before searching them. |2.1.7 |+^Raw-''<headername>''  |This lets you search a specific field in the message header. Any header name can be used. MIME encoded header lines will not be decoded before searching them. The header name should be typed without the angle brackets (<>). |2.1.7 |
 ^attachment  |This searches all the attachment filenames in the message |2.1.11 | ^attachment  |This searches all the attachment filenames in the message |2.1.11 |
 ^rawmessage  |This lets you search through the first 10kB of the raw, undecoded message content.|2.2.1 | ^rawmessage  |This lets you search through the first 10kB of the raw, undecoded message content.|2.2.1 |
Line 37: Line 39:
  
 =====Search===== =====Search=====
-The search parameter to the **IfMatch** statement can either be a regular expression or a simple substring search string.+The search parameter to the **IfMatch** statement can either be a regular expression or a simple case insensitive substring search string.
  
 You should put quotes around the text or Perl Compatible Regular Expression (PCRE) to search for. You should put quotes around the text or Perl Compatible Regular Expression (PCRE) to search for.
Line 53: Line 55:
 ^D  |The dollar character matches only at the end of the search string. Without this, it can also match immediately before the final character if it is a newline character. | ^D  |The dollar character matches only at the end of the search string. Without this, it can also match immediately before the final character if it is a newline character. |
 ^U  |The search will be “ungreedy” instead of the default mode of greedy. | ^U  |The search will be “ungreedy” instead of the default mode of greedy. |
- 
-The **IfMatch** statement must be terminated with an **EndIf** and may contain an **Else** statement, just like the [[spamrules_statement_if|If]] statement. 
  
  
  
 =====Example===== =====Example=====
-This following example will perform a regular expression search of the Subject line of the message header to see if it contains the text **hello** anywhere.+This following example will perform a case insensitive regular expression search of the Subject line of the message header to see if it contains the text **hello** anywhere.
 <code> <code>
 IfMatch subject "/.*hello.*/i" IfMatch subject "/.*hello.*/i"
 +# Statements
 +EndIf
 +</code>
 +
 +The example above does not need a regular expression and could also be achieved with a substring search, like so:
 +<code>
 +IfMatch subject "hello"
 +# Statements
 +EndIf
 +</code>
 +
 +This following example uses a regular expression to check whether a Cc header is present 
 +<code>
 +IfMatch cc "/./"
 # Statements # Statements
 EndIf EndIf
 </code> </code>
reference/spamrules_statement_ifmatch.1314020314.txt.gz · Last modified: 2018/11/14 10:44 (external edit)