From 8fa2ee03f5300734753165a791e90b36e8681ccb Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Thu, 22 Jan 2009 00:19:41 +0100
Subject: [PATCH] Regex: fixed bug in the match value indexes.

---
 src/lib-sieve/plugins/regex/mcht-regex.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lib-sieve/plugins/regex/mcht-regex.c b/src/lib-sieve/plugins/regex/mcht-regex.c
index 7707c92e3..54685adcc 100644
--- a/src/lib-sieve/plugins/regex/mcht-regex.c
+++ b/src/lib-sieve/plugins/regex/mcht-regex.c
@@ -268,8 +268,10 @@ static int mcht_regex_match
 				str_truncate(subst, 0);
 			
 				if ( ctx->pmatch[i].rm_so != -1 ) {
-					if ( skipped > 0 )
+					if ( skipped > 0 ) {
 						sieve_match_values_skip(mvalues, skipped);
+						skipped = 0;
+					}
 					
 					str_append_n(subst, val + ctx->pmatch[i].rm_so, 
 						ctx->pmatch[i].rm_eo - ctx->pmatch[i].rm_so);
-- 
GitLab