diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c index 2e3a2ced23c6..a5416ee4429b 100644 --- a/usr.bin/sed/compile.c +++ b/usr.bin/sed/compile.c @@ -324,9 +324,17 @@ semicolon: EATSPACE(); if (p == NULL) errx(1, "%lu: %s: unterminated substitute pattern", linenum, fname); + + /* Compile RE with no case sensitivity temporarily */ + if (*re == '\0') + cmd->u.s->re = NULL; + else + cmd->u.s->re = compile_re(re, 0); --p; p = compile_subst(p, cmd->u.s); p = compile_flags(p, cmd->u.s); + + /* Recompile RE with case sensitivity from "I" flag if any */ if (*re == '\0') cmd->u.s->re = NULL; else