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/ja | |
parent | c8f574d7305b5a064b084e82d93cd90950ea2306 (diff) | |
download | weechat-cd65198c713577e3fee2232a10984fedfc274aa9.zip |
api: add callback in function string_replace_regex
Diffstat (limited to 'doc/ja')
-rw-r--r-- | doc/ja/weechat_plugin_api.ja.txt | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/ja/weechat_plugin_api.ja.txt b/doc/ja/weechat_plugin_api.ja.txt index 42032beef..136950763 100644 --- a/doc/ja/weechat_plugin_api.ja.txt +++ b/doc/ja/weechat_plugin_api.ja.txt @@ -1269,14 +1269,17 @@ free (str); _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. プロトタイプ: [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); ---- 引数: @@ -1293,6 +1296,13 @@ char *weechat_string_replace_regex (const char *string, void *regex, ** `$.*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 戻り値: @@ -1310,7 +1320,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); |