From e337e5f634dcb0e74999d67286125a85423e38a9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jan 2013 18:21:51 +0100 Subject: [PATCH] updated for version 7.3.796 Problem: "/[^\n]" does match at a line break. Solution: Make it do the same as "/.". (Christian Brabandt) --- src/regexp.c | 11 +++++++---- src/testdir/test79.in | Bin 2531 -> 2575 bytes src/testdir/test79.ok | Bin 397 -> 401 bytes src/version.c | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/regexp.c b/src/regexp.c index b6506a03a..d85ded8af 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -2397,13 +2397,15 @@ collection: /* '\n' in range: also match NL */ if (ret != JUST_CALC_SIZE) { - if (*ret == ANYBUT) - *ret = ANYBUT + ADD_NL; - else if (*ret == ANYOF) + /* Using \n inside [^] does not change what + * matches. "[^\n]" is the same as ".". */ + if (*ret == ANYOF) + { *ret = ANYOF + ADD_NL; + *flagp |= HASNL; + } /* else: must have had a \n already */ } - *flagp |= HASNL; regparse++; startc = -1; } @@ -4344,6 +4346,7 @@ regmatch(scan) break; /* Matched with EOW */ case ANY: + /* ANY does not match new lines. */ if (c == NUL) status = RA_NOMATCH; else diff --git a/src/testdir/test79.in b/src/testdir/test79.in index 8fa11d9ad79cd389169051166babb22d8e1f4041..f83b6b6e2265fe6f2581e015e3e0e94c01ed3fa6 100644 GIT binary patch delta 58 zcmaDX+%K}Bo>NUfE>MNbs#rfTIxZ$JHc&stwzxDYH?br+L&HE*Pbn=wKPju*6 NG;<(V;NEgC delta 36 pcmeAdc`Ur4o>Rir&n3h)IE0G}M8=z2aXIojayc