From 77a94ce9b3956188b40a9a1ff63cbdc386d8aa7d Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Thu, 4 Oct 2018 21:23:47 +0900 Subject: [PATCH] expand case fold if string is a single character case --- src/regcomp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/regcomp.c b/src/regcomp.c index 8e83266..31a8e35 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -3664,7 +3664,10 @@ expand_case_fold_string(Node* node, regex_t* reg) len = enclen(reg->enc, p); is_good = is_good_case_fold_items_for_search(reg->enc, len, n, items); - if (is_good || IS_NOT_NULL(snode)) { + if (IS_NOT_NULL(snode) || + (is_good && + /* expand single char case: ex. /(?i:a)/ */ + !(p == start && p + len >= end))) { if (IS_NULL(snode)) { if (IS_NULL(root) && IS_NOT_NULL(prev_node)) { top_root = root = onig_node_list_add(NULL_NODE, prev_node); -- 2.50.1