summaryrefslogtreecommitdiff
path: root/src/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 /src/core
parentf0c8da2f05a4b463cbc7d03341ee8a7a6db45f61 (diff)
downloadweechat-bb00b6b8fb895e85d2959bebba9d49fe9de61438.zip
core: add ${re:#} to get the index of last group captured in evaluation of expressions
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-eval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c
index 62dc6981b..016d99c2d 100644
--- a/src/core/wee-eval.c
+++ b/src/core/wee-eval.c
@@ -464,6 +464,12 @@ eval_replace_vars_cb (void *data, const char *text)
{
if (strcmp (text + 3, "+") == 0)
number = eval_regex->last_match;
+ else if (strcmp (text + 3, "#") == 0)
+ {
+ snprintf (str_value, sizeof (str_value),
+ "%d", eval_regex->last_match);
+ return strdup (str_value);
+ }
else
{
number = strtol (text + 3, &error, 10);