diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-05-11 01:34:33 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-05-11 01:34:33 +0000 |
commit | 039a94478ee4f8b3154e99812223614e03ac186c (patch) | |
tree | 0e4a60fcf8f023cdd67f3e8132c6e5e6ced199dc /regex.c | |
parent | 27e948fd458b06c3a018d46f04599a874f43fd92 (diff) |
.*/.+/.?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r-- | regex.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -1234,10 +1234,14 @@ re_compile_pattern(pattern, size, bufp) if (!laststart) break; - if (greedy && *laststart == anychar && b - laststart < 2) { + if (greedy && many_times_ok && *laststart == anychar && b - laststart <= 2) { if (b[-1] == stop_paren) b--; - *laststart = anychar_repeat; + if (zero_times_ok) + *laststart = anychar_repeat; + else { + BUFPUSH(anychar_repeat); + } break; } /* Now we know whether or not zero matches is allowed @@ -3375,7 +3379,7 @@ re_match(bufp, string_arg, size, pos, regs) /* End of pattern means we might have succeeded. */ if (p == pend) { /* If not end of string, try backtracking. Otherwise done. */ - if ((bufp->options & RE_OPTION_POSIXMATCH) && d != dend) { + if ((bufp->options & RE_OPTION_LONGEST) && d != dend) { if (best_regs_set) /* non-greedy, no need to backtrack */ goto restore_best_regs; while (stackp != stackb && stackp[-1] == NON_GREEDY) { @@ -3810,9 +3814,9 @@ re_match(bufp, string_arg, size, pos, regs) /* Jump without taking off any failure points. */ case jump: nofinalize: - EXTRACT_NUMBER_AND_INCR(mcnt, p); - p += mcnt; - continue; + EXTRACT_NUMBER_AND_INCR(mcnt, p); + p += mcnt; + continue; /* We need this opcode so we can detect where alternatives end in `group_match_null_string_p' et al. */ |