summaryrefslogtreecommitdiff
path: root/tests/unit/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-03-30 22:13:14 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-03-30 22:13:14 +0200
commitbb00b6b8fb895e85d2959bebba9d49fe9de61438 (patch)
treef751d79ce8c49eedc7164916349d14be6ec638b5 /tests/unit/core
parentf0c8da2f05a4b463cbc7d03341ee8a7a6db45f61 (diff)
downloadweechat-bb00b6b8fb895e85d2959bebba9d49fe9de61438.zip
core: add ${re:#} to get the index of last group captured in evaluation of expressions
Diffstat (limited to 'tests/unit/core')
-rw-r--r--tests/unit/core/test-eval.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unit/core/test-eval.cpp b/tests/unit/core/test-eval.cpp
index 4f2a92e8e..e0bd236b7 100644
--- a/tests/unit/core/test-eval.cpp
+++ b/tests/unit/core/test-eval.cpp
@@ -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);