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:
@@ -402,6 +402,13 @@ TEST(Eval, EvalReplaceRegex)
|
||||
"password=abc password=def");
|
||||
regfree (®ex);
|
||||
|
||||
/* 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);
|
||||
|
||||
Reference in New Issue
Block a user