summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-02-18 01:56:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-02-18 01:56:47 +0000
commita9662810df18371af7492dd8298cc0cccc13c7c7 (patch)
tree5a1131ad0ca461f67177e1c7282eacc92356f864 /regex.c
parent14aa2e8dda852b6b9277a8a7e16a78654edf1767 (diff)
1.1b8pre1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@76 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c11
1 files changed, 7 insertions, 4 deletions
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