aboutsummaryrefslogtreecommitdiff
path: root/jimregexp.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2019-11-01 16:56:20 +1000
committerSteve Bennett <steveb@workware.net.au>2019-11-01 16:59:55 +1000
commitc596e023b75e2e17a9b338ac0ba09a51fd5995a9 (patch)
treeed008e58fa98b13508186080b7d458971d599be1 /jimregexp.c
parent4d95af99120bfcfef74b544934efafdfc2563e88 (diff)
downloadjimtcl-c596e023b75e2e17a9b338ac0ba09a51fd5995a9.zip
jimtcl-c596e023b75e2e17a9b338ac0ba09a51fd5995a9.tar.gz
jimtcl-c596e023b75e2e17a9b338ac0ba09a51fd5995a9.tar.bz2
regexp,regsub: utf8: Fix incorrect count with . matches
Internally bytes were being counted rather than characters Reported-by: dbohdan <dbohdan@dbohdan.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jimregexp.c')
-rw-r--r--jimregexp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/jimregexp.c b/jimregexp.c
index 3771bd7..5b2d60c 100644
--- a/jimregexp.c
+++ b/jimregexp.c
@@ -1612,10 +1612,9 @@ static int regrepeat(regex_t *preg, int p, int max)
opnd = OPERAND(p);
switch (OP(preg, p)) {
case ANY:
- /* No need to handle utf8 specially here */
while (!reg_iseol(preg, *scan) && count < max) {
count++;
- scan++;
+ scan += utf8_charlen(*scan);
}
break;
case EXACTLY: