From a9662810df18371af7492dd8298cc0cccc13c7c7 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 18 Feb 1998 01:56:47 +0000 Subject: 1.1b8pre1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@76 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- regex.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'regex.c') diff --git a/regex.c b/regex.c index 152eebbf6d..d9269fa5a9 100644 --- a/regex.c +++ b/regex.c @@ -1748,7 +1748,7 @@ re_compile_pattern(pattern, size, bufp) c1 = 0; if (ismbchar(c)) { c1 = c; - PATFETCH(c); + PATFETCH_RAW(c); } else if (c > 0x7f) { c1 = 0xff; @@ -2418,7 +2418,7 @@ re_search(bufp, string, size, startpos, range, regs) if (fastmap && startpos == size && range >= 0 && (bufp->can_be_null == 0 || - (bufp->can_be_null == 2 && size > 0 + (bufp->can_be_null && size > 0 && string[startpos-1] == '\n'))) return -1; @@ -3000,16 +3000,19 @@ re_match(bufp, string_arg, size, pos, regs) break; goto fail; - /* Match at the very beginning of the string. */ + /* Match at the very beginning of the string. */ case begbuf: if (AT_STRINGS_BEG(d)) break; goto fail; - /* Match at the very end of the data. */ + /* Match at the very end of the data. */ case endbuf: if (AT_STRINGS_END(d)) break; + /* .. or newline just before the end of the data. */ + if (*d == '\n' && AT_STRINGS_END(d+1)) + break; goto fail; /* `or' constructs are handled by starting each alternative with -- cgit v1.2.3