diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-28 13:51:49 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-28 13:51:49 +0100 |
commit | ea585b11e57b40046426597e09a550b3214d6b3a (patch) | |
tree | 68bb5bedee34d0a7af0f01f049c9c1561e98a94d /doc/markdown/modules/regexp.md | |
parent | dcbd11070d3c4b923fce55b30bb1ead93591296c (diff) | |
download | rspamd-ea585b11e57b40046426597e09a550b3214d6b3a.tar.gz rspamd-ea585b11e57b40046426597e09a550b3214d6b3a.zip |
Add documentation for the changes.
Diffstat (limited to 'doc/markdown/modules/regexp.md')
-rw-r--r-- | doc/markdown/modules/regexp.md | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/doc/markdown/modules/regexp.md b/doc/markdown/modules/regexp.md index 59ddaa67e..4964a4d2c 100644 --- a/doc/markdown/modules/regexp.md +++ b/doc/markdown/modules/regexp.md @@ -97,5 +97,32 @@ Many of these functions are just legacy but they are supported in terms of compa ### Lua atoms -Lua atoms now can be lua global functions names. This is supported merely for compatibility and it is -a subject of future redesign.
\ No newline at end of file +Lua atoms now can be lua global functions names or callbacks. This is +a compatibility feature for previously written rules. + +### Regexp objects + +From rspamd 1.0, it is possible to add more power to regexp rules by using of +table notation while writing rules. A table can have the following fields: + +- `callback`: lua callback for the rule +- `re`: regular expression (mutually exclusive with `callback` option) +- `condition`: function of task that determines when a rule should be executed +- `score`: default score +- `description`: default description +- `one_shot`: default one shot settings + +Here is an example of table form definition of regexp rule: + +~~~lua +config['regexp']['RE_TEST'] = { + re = '/test/P', + score = 10.0, + condition = function(task) + if task:get_header('Subject') then + return true + end + return false + end, +} +~~~
\ No newline at end of file |