Rotate the first and last non-capturing groups to capture the groups so that you can refer to the characters in the spare part and delete the unnecessary second capture group.
string w_name = "0x010102_default_prg_L2_E2_LDep1_LLC"; string regex_exp = @"(E\d)[\w\d_]+(_LLC)"; w_name = Regex.Replace(w_name, regex_exp, "$1$2");
Demo
or
string regex_exp = @"(?<=E\d)[\w\d_]+(?=_LLC)"; w_name = Regex.Replace(w_name, regex_exp, string.Empty);
source share