diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index 8cd0c69b4..5266ee881 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -6817,12 +6817,6 @@ static void test_re_substitute() { do_test(res && *res == L"AA123qqqZZ AA123qqqZZ"); do_test(repl_count == 2); - sflags.literal = true; - res = re->substitute(subj, repl, sflags, 0, nullptr, &repl_count); - do_test(res && *res == L"AA$1qqqZZ AA$1qqqZZ"); - do_test(repl_count == 2); - - sflags.literal = false; sflags.extended = true; res = re->substitute(subj, L"\\x21", sflags, 0, nullptr, &repl_count); // \x21 = ! do_test(res && *res == L"AA!ZZ AA!ZZ"); diff --git a/src/re.cpp b/src/re.cpp index 1064fb70f..03079bd6d 100644 --- a/src/re.cpp +++ b/src/re.cpp @@ -237,7 +237,6 @@ maybe_t regex_t::substitute(const wcstring &subject, const wcstring &r uint32_t options = PCRE2_SUBSTITUTE_UNSET_EMPTY // don't error on unmatched | PCRE2_SUBSTITUTE_OVERFLOW_LENGTH // return required length on overflow | (flags.global ? PCRE2_SUBSTITUTE_GLOBAL : 0) // replace multiple - | (flags.literal ? PCRE2_SUBSTITUTE_LITERAL : 0) // respect $1, etc. | (flags.extended ? PCRE2_SUBSTITUTE_EXTENDED : 0) // backslash escapes ; size_t bufflen = stack_bufflen; diff --git a/src/re.h b/src/re.h index 02848bcb6..5a503099b 100644 --- a/src/re.h +++ b/src/re.h @@ -32,7 +32,6 @@ struct flags_t { /// Flags for substituting a regex. struct sub_flags_t { bool global{}; // perform multiple substitutions? - bool literal{}; // $1 is literal, not a capture reference bool extended{}; // apply PCRE2 extended backslash escapes? };