summaryrefslogtreecommitdiffstats
path: root/src/regexp_bt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regexp_bt.c')
-rw-r--r--src/regexp_bt.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/regexp_bt.c b/src/regexp_bt.c
index 522cf37e2d..198946e0dc 100644
--- a/src/regexp_bt.c
+++ b/src/regexp_bt.c
@@ -3743,13 +3743,38 @@ regmatch(
case ANYOF:
case ANYBUT:
- if (c == NUL)
- status = RA_NOMATCH;
- else if ((cstrchr(OPERAND(scan), c) == NULL) == (op == ANYOF))
- status = RA_NOMATCH;
- else
- ADVANCE_REGINPUT();
- break;
+ {
+ char_u *q = OPERAND(scan);
+
+ if (c == NUL)
+ status = RA_NOMATCH;
+ else if ((cstrchr(q, c) == NULL) == (op == ANYOF))
+ status = RA_NOMATCH;
+ else
+ {
+ // Check following combining characters
+ int len = 0;
+ int i;
+
+ if (enc_utf8)
+ len = utfc_ptr2len(q) - utf_ptr2len(q);
+
+ MB_CPTR_ADV(rex.input);
+ MB_CPTR_ADV(q);
+
+ if (!enc_utf8 || len == 0)
+ break;
+
+ for (i = 0; i < len; ++i)
+ if (q[i] != rex.input[i])
+ {
+ status = RA_NOMATCH;
+ break;
+ }
+ rex.input += len;
+ }
+ break;
+ }
case MULTIBYTECODE:
if (has_mbyte)