1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 15:26:37 +02:00

core: add ${re:#} to get the index of last group captured in evaluation of expressions

This commit is contained in:
Sébastien Helleu
2017-03-30 22:13:14 +02:00
parent f0c8da2f05
commit bb00b6b8fb
6 changed files with 62 additions and 12 deletions
+7
View File
@@ -402,6 +402,13 @@ TEST(Eval, EvalReplaceRegex)
"password=abc password=def");
regfree (&regex);
/* regex groups */
hashtable_remove (pointers, "regex");
hashtable_set (options, "regex", "([a-z]+) ([a-z]+) ([a-z]+) ([a-z]+)");
hashtable_set (options, "regex_replace",
"${re:0} -- ${re:1} ${re:+} (${re:#})");
WEE_CHECK_EVAL("abc def ghi jkl -- abc jkl (4)", "abc def ghi jkl");
hashtable_free (pointers);
hashtable_free (extra_vars);
hashtable_free (options);