summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authorwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 14:52:18 +0000
committerwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 14:52:18 +0000
commit885527dec71812e613ecd77b2cdfb7f448b52664 (patch)
tree15f1191f249b91a568ad1b92ceaa0ddeae8bb0fa /regex.c
parent38c8d6df29fac3d1e1e12706fcbe07b9428ce8a4 (diff)
regexp.c: Backport #3403; backported from r28192 to fix a bug with non-greedy matching.
test/ruby/test_regexp.rb: Backport #3403; added this test suite, commenting out inapplicable tests to the current 1.8.6. ChangeLog: Got my date wrong in the last few entries. Tuesday is the 8th, not the 9th! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/regex.c b/regex.c
index 54f6b4c9a1..416bb0f9ec 100644
--- a/regex.c
+++ b/regex.c
@@ -2147,6 +2147,12 @@ re_compile_pattern(pattern, size, bufp)
more at the end of the loop. */
unsigned nbytes = upper_bound == 1 ? 10 : 20;
+ if (lower_bound == 0 && greedy == 0) {
+ GET_BUFFER_SPACE(3);
+ insert_jump(try_next, laststart, b + 3, b);
+ b += 3;
+ }
+
GET_BUFFER_SPACE(nbytes);
/* Initialize lower bound of the `succeed_n', even
though it will be set during matching by its