[Freeswitch-svn] [commit] r6588 - freeswitch/trunk/src

Freeswitch SVN brian at freeswitch.org
Mon Dec 10 11:27:49 EST 2007


Author: brian
Date: Mon Dec 10 11:27:48 2007
New Revision: 6588

Modified:
   freeswitch/trunk/src/switch_regex.c

Log:
fix offset in regex expansion

Modified: freeswitch/trunk/src/switch_regex.c
==============================================================================
--- freeswitch/trunk/src/switch_regex.c	(original)
+++ freeswitch/trunk/src/switch_regex.c	Mon Dec 10 11:27:48 2007
@@ -109,6 +109,7 @@
 							ovector,	/* vector of integers for substring information */
 							olen);	/* number of elements (NOT size in bytes) */
 
+
 	if (match_count <= 0) {
 		switch_regex_safe_free(re);
 		match_count = 0;
@@ -145,7 +146,12 @@
 			}
 			index[z++] = '\0';
 			z = 0;
-			num = atoi(index);
+			if (match_count > 1) {
+				int offset = match_count - 2;
+				num = atoi(index) + offset;
+			} else {
+				num = atoi(index);
+			}
 
 			if (pcre_copy_substring(field_data, ovector, match_count, num, replace, sizeof(replace)) > 0) {
 				switch_size_t r;



More information about the Freeswitch-svn mailing list