From 2e39a9a44f11e6989565fc0d832f67c335c67873 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 29 Apr 2023 11:40:10 +0300 Subject: [#strings/glsub] Fixed bad behaviour when regexp matches next to each other (and lbregexp regexp largexep doesn't match longer) --- awk-edits/#strings.awk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'awk-edits/#strings.awk') diff --git a/awk-edits/#strings.awk b/awk-edits/#strings.awk index 6972105..074e42a 100644 --- a/awk-edits/#strings.awk +++ b/awk-edits/#strings.awk @@ -57,7 +57,8 @@ function glsub(lbregexp, regexp, laregexp, replacement, target) { target = substr(target, length(surrounds[1]) + 1); for (i = 2; i <= surlen; i++) { if (surrounds[i] == "") { - si = length(target) + 1; + match(target, lbregexp regexp laregxep); + si = RLENGTH + 1; } else { si = index(target, surrounds[i]); -- cgit v1.3.1-26-gb76a