diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-01-26 10:15:35 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-01-26 10:15:35 +0100 |
commit | 6d217ca8c54b53a3741992c63eefb704fc9de906 (patch) | |
tree | 6ed90c91b7a6e162c29ed8e15e084a4d54c98214 /doc/ja/weechat_plugin_api.ja.adoc | |
parent | 73a4901fe1f3ed884efcbb49d204d1466215f89c (diff) | |
download | weechat-6d217ca8c54b53a3741992c63eefb704fc9de906.zip |
doc: fix regex examples to be compatible with FreeBSD
The following special sequences are not supported in regular expressions on
FreeBSD:
- "\w": replaced with "[a-zA-Z0-9_]"
- "\S": replaced with "[^ ]" (it should be "[^ \t\n\r\f\v]", but in practice
only spaces could be a problem when we use this sequence).
Diffstat (limited to 'doc/ja/weechat_plugin_api.ja.adoc')
-rw-r--r-- | doc/ja/weechat_plugin_api.ja.adoc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index 98a97ad40..7fbc93217 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -2075,12 +2075,12 @@ struct t_hashtable *options2 = weechat_hashtable_new (8, NULL, NULL); /* URL に関するブラックリストを追加 */ -weechat_hashtable_set (options2, "regex", "\\w+://\\S+"); +weechat_hashtable_set (options2, "regex", "[a-zA-Z0-9_]+://[^ ]+"); weechat_hashtable_set (options2, "regex_replace", "[ ${re:0} ]"); char *str4 = weechat_string_eval_expression ("test: https://weechat.org", NULL, NULL, NULL); /* "test: [ https://weechat.org ]" */ /* パスワードを隠す */ -weechat_hashtable_set (options2, "regex", "(password=)(\\S+)"); +weechat_hashtable_set (options2, "regex", "(password=)([^ ]+)"); weechat_hashtable_set (options2, "regex_replace", "${re:1}${hide:*,${re:2}}"); char *str5 = weechat_string_eval_expression ("password=abc password=def", NULL, NULL, NULL); /* "password=*** password=***" */ ---- @@ -2103,14 +2103,14 @@ str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core # 正規表現を用いた置換: URL に関するブラックリストを追加 options = { - "regex": "\\w+://\\S+", + "regex": "[a-zA-Z0-9_]+://[^ ]+", "regex_replace": "[ ${re:0} ]", } str4 = weechat.string_eval_expression("test: https://weechat.org", {}, {}, options) # "test: [ https://weechat.org ]" # 正規表現を用いた置換: パスワードを隠す options = { - "regex": "(password=)(\\S+)", + "regex": "(password=)([^ ]+)", "regex_replace": "${re:1}${hide:*,${re:2}}", } str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***" |