diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2014-03-13 10:59:58 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2014-03-13 10:59:58 +0100 |
commit | cd65198c713577e3fee2232a10984fedfc274aa9 (patch) | |
tree | 667d54587a06bcf897e71a5b36ef4f176245bd35 /doc/it | |
parent | c8f574d7305b5a064b084e82d93cd90950ea2306 (diff) | |
download | weechat-cd65198c713577e3fee2232a10984fedfc274aa9.zip |
api: add callback in function string_replace_regex
Diffstat (limited to 'doc/it')
-rw-r--r-- | doc/it/weechat_plugin_api.it.txt | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index 62ae887e6..eaccf8cc0 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -1302,14 +1302,17 @@ Questa funzione non è disponibile nelle API per lo scripting. _WeeChat ≥ 0.4.4._ // TRANSLATION MISSING -Replace text in a string using a regular expression and replacement text. +Replace text in a string using a regular expression, replacement text and +optional callback. Prototipo: [source,C] ---- char *weechat_string_replace_regex (const char *string, void *regex, - const char *replace, const char reference_char); + const char *replace, const char reference_char, + char *(*callback)(void *data, const char *text), + void *callback_data); ---- Argomenti: @@ -1326,6 +1329,13 @@ Argomenti: ** `$.*N`: match `N` (can be `+` or `0` to `99`), with all chars replaced by `*` (the `*` char can be any char between space (32) and `~` (126)) * 'reference_char': the char used for reference to match (commonly '$') +* 'callback': an optional callback called for each reference in 'replace' + (except for matches replaced by a char); the callback must return: +** newly allocated string: it is used as replacement text (it is freed after + use) +** NULL: the text received in callback is used as replacement text (without + changes) +* 'callback_data': pointer given to callback when it is called Valore restituito: @@ -1343,7 +1353,7 @@ if (weechat_string_regcomp (&my_regex, "([0-9]{4})-([0-9]{2})-([0-9]{2})", REG_EXTENDED) == 0) { string = weechat_string_replace_regex ("date: 2014-02-14", &my_regex, - "$3/$2/$1", '$'); + "$3/$2/$1", '$', NULL, NULL); /* string == "date: 14/02/2014" */ if (string) free (string); |