# HG changeset patch # User Bram Moolenaar # Date 1369907468 -7200 # Node ID 5679b8ddd8cc0eb004cbb61babb336c3af398c92 # Parent 560c247794b8a4880a9c25c59d6e40588a36b923 updated for version 7.3.1055 Problem: Negated collection does not match newline. Solution: Handle newline differently. (Hiroshi Shirosaki) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -1203,13 +1203,6 @@ collection: } mb_ptr_adv(regparse); - if (extra == ADD_NL) /* \_[] also matches \n */ - { - EMIT(reg_string ? NL : NFA_NEWL); - TRY_NEG(); - EMIT_GLUE(); - } - /* skip the trailing ] */ regparse = endp; mb_ptr_adv(regparse); @@ -1219,6 +1212,14 @@ collection: EMIT(NFA_END_NEG_RANGE); EMIT(NFA_CONCAT); } + + /* \_[] also matches \n but it's not negated */ + if (extra == ADD_NL) + { + EMIT(reg_string ? NL : NFA_NEWL); + EMIT(NFA_OR); + } + return OK; } /* if exists closing ] */ diff --git a/src/testdir/test64.in b/src/testdir/test64.in --- a/src/testdir/test64.in +++ b/src/testdir/test64.in @@ -344,9 +344,13 @@ STARTTEST :call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx