summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c4
-rw-r--r--test/ruby/test_regexp.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index 664806f085..3b738b1a67 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4309,8 +4309,6 @@ set_bm_skip(UChar* s, UChar* end, regex_t* reg,
len = end - s;
if (len < ONIG_CHAR_TABLE_SIZE) {
- for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) skip[i] = (UChar )(len + 1);
-
if (ignore_case) {
for (i = 0; i < len; i += clen) {
p = s + i;
@@ -4339,6 +4337,8 @@ endcheck:
}
len = end - s;
+ for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++)
+ skip[i] = (UChar )(len + 1);
n = 0;
for (i = 0; i < len; i += clen) {
p = s + i;
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index b69c148305..2d7a67dd54 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1743,6 +1743,10 @@ class TestRegexp < Test::Unit::TestCase
assert_raise(RegexpError, bug12418){ Regexp.new('(0?0|(?(5)||)|(?(5)||))?') }
end
+ def test_quick_search
+ assert_match_at('(?i) *TOOKY', 'Mozilla/5.0 (Linux; Android 4.0.3; TOOKY', [[34, 40]]) # Issue #120
+ end
+
def test_ss_in_look_behind
assert_match_at("(?i:ss)", "ss", [[0, 2]])
assert_match_at("(?i:ss)", "Ss", [[0, 2]])