summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@wiw.org>2002-11-07 01:08:11 +0530
committerhv <hv@crypt.org>2002-12-09 00:02:57 +0000
commitada6e8a992d3696f2a5e84c5e93d2fce8998ecfb (patch)
treed864841417cc4e3dbda7bab81e3a1e625168385a /regcomp.c
parent3b9d212931c328bf8f0ad8c51694e8b569ec046e (diff)
downloadperl-ada6e8a992d3696f2a5e84c5e93d2fce8998ecfb.tar.gz
Re: [perl #18107] lc(), uc() and ucfirst() broken inside utf8 regex
Message-ID: <20021106193811.E20858@lustre.dyn.wiw.org> p4raw-id: //depot/perl@18266
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 50219d9a81..1f53655190 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5065,6 +5065,23 @@ Perl_save_re_context(pTHX)
SAVEVPTR(PL_reg_curpm); /* from regexec.c */
SAVEI32(PL_regnpar); /* () count. */
SAVEI32(PL_regsize); /* from regexec.c */
+
+ {
+ /* Save $1..$n (#18107: UTF-8 s/(\w+)/uc($1)/e); AMS 20021106. */
+ int i;
+ GV *mgv;
+ REGEXP *rx;
+ char digits[16];
+
+ if (PL_curpm && (rx = PM_GETRE(PL_curpm))) {
+ for (i = 1; i <= rx->nparens; i++) {
+ sprintf(digits, "%lu", i);
+ if ((mgv = gv_fetchpv(digits, FALSE, SVt_PV)))
+ save_scalar(mgv);
+ }
+ }
+ }
+
#ifdef DEBUGGING
SAVEPPTR(PL_reg_starttry); /* from regexec.c */
#endif