This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix for failure to match $foo =~ /(?i)/ (from Ilya Zakharevich)
[perl5.git] / regcomp.c
index c0425b7..7af090e 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -2296,8 +2296,14 @@ tryagain:
        nextchar();
        ret = reg(1, &flags);
        if (ret == NULL) {
-               if (flags & TRYAGAIN)
+               if (flags & TRYAGAIN) {
+                   if (PL_regcomp_parse == PL_regxend) {
+                        /* Make parent create an empty node if needed. */
+                       *flagp |= TRYAGAIN;
+                       return(NULL);
+                   }
                    goto tryagain;
+               }
                return(NULL);
        }
        *flagp |= flags&(HASWIDTH|SPSTART|SIMPLE);