summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/string.c b/string.c
index b5a387e88b..0c9f5fb23a 100644
--- a/string.c
+++ b/string.c
@@ -2408,8 +2408,11 @@ scan_once(str, pat, start)
if (reg_search(pat, str, *start, 0) >= 0) {
match = backref_get();
regs = RMATCH(match)->regs;
- if (END(0) == *start) {
- *start = END(0)+1;
+ if (BEG(0) == END(0)) {
+ /*
+ * Always consume at least one character of the input string
+ */
+ *start = END(0)+(ismbchar(RSTRING(str)->ptr[END(0)])?2:1);
}
else {
*start = END(0);