@@ -367,7 +367,7 @@ static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
367367static char_u e_unmatchedpar [] = N_ ("E55: Unmatched %s)" );
368368#ifdef FEAT_SYN_HL
369369static char_u e_z_not_allowed [] = N_ ("E66: \\z( not allowed here" );
370- static char_u e_z1_not_allowed [] = N_ ("E67: \\z1 et al. not allowed here" );
370+ static char_u e_z1_not_allowed [] = N_ ("E67: \\z1 - \\z9 not allowed here" );
371371#endif
372372static char_u e_missing_sb [] = N_ ("E69: Missing ] after %s%%[" );
373373static char_u e_empty_sb [] = N_ ("E70: Empty %s%%[]" );
@@ -2139,7 +2139,7 @@ regatom(int *flagp)
21392139 switch (c )
21402140 {
21412141#ifdef FEAT_SYN_HL
2142- case '(' : if (reg_do_extmatch != REX_SET )
2142+ case '(' : if (( reg_do_extmatch & REX_SET ) == 0 )
21432143 EMSG_RET_NULL (_ (e_z_not_allowed ));
21442144 if (one_exactly )
21452145 EMSG_ONE_RET_NULL ;
@@ -2158,7 +2158,7 @@ regatom(int *flagp)
21582158 case '6' :
21592159 case '7' :
21602160 case '8' :
2161- case '9' : if (reg_do_extmatch != REX_USE )
2161+ case '9' : if (( reg_do_extmatch & REX_USE ) == 0 )
21622162 EMSG_RET_NULL (_ (e_z1_not_allowed ));
21632163 ret = regnode (ZREF + c - '0' );
21642164 re_has_z = REX_USE ;
@@ -8332,8 +8332,8 @@ vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col)
83328332
83338333/*
83348334 * Match a regexp against multiple lines.
8335- * "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
8336- * Note: "rmp->regprog" may be freed and changed.
8335+ * "rmp->regprog" must be a compiled regexp as returned by vim_regcomp().
8336+ * Note: "rmp->regprog" may be freed and changed, even set to NULL .
83378337 * Uses curbuf for line count and 'iskeyword'.
83388338 *
83398339 * Return zero if there is no match. Return number of lines contained in the
@@ -8376,7 +8376,12 @@ vim_regexec_multi(
83768376#ifdef FEAT_EVAL
83778377 report_re_switch (pat );
83788378#endif
8379+ // checking for \z misuse was already done when compiling for NFA,
8380+ // allow all here
8381+ reg_do_extmatch = REX_ALL ;
83798382 rmp -> regprog = vim_regcomp (pat , re_flags );
8383+ reg_do_extmatch = 0 ;
8384+
83808385 if (rmp -> regprog != NULL )
83818386 result = rmp -> regprog -> engine -> regexec_multi (
83828387 rmp , win , buf , lnum , col , tm , timed_out );
0 commit comments