Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commita9f641a6ec9d70ab4d78f6280ede0d5e64c3d50c (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-04-29 15:21:32 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-04-29 15:21:47 +0300
Files7493e760739f835ebcb2d9f8167e31e3754c070a
syndamia.com-a9f641a6ec9d70ab4d78f6280ede0d5e64c3d50c.tar
syndamia.com-a9f641a6ec9d70ab4d78f6280ede0d5e64c3d50c.tar.gz
syndamia.com-a9f641a6ec9d70ab4d78f6280ede0d5e64c3d50c.zip
Parente5be7ac510d900ee81a55d4c71eec228872d5457 (diff)
[#strings/glsub] Added documentation
1 files changed, 7 insertions, 1 deletions
-rw-r--r--awk-edits/#strings.awk8
diff --git a/awk-edits/#strings.awk b/awk-edits/#strings.awk
index 5e486bb..3365df2 100644
--- a/awk-edits/#strings.awk
+++ b/awk-edits/#strings.awk
@@ -44,8 +44,14 @@ function gesub(regexp, exregexp, replacement, target) {
return result target;
}
-# glsub(lbregexp, regexp, largexp, replacement [, empt, target])
+# glsub(lbregexp, regexp, largexp, replacement [, target])
# Aka global sub with non-capturing look-around (lookbehind and lookahead)
+# Behaves kind of like gsub, however substitution of regexp with replacement
+# only happens, when regexp is preceded by lbregexp and succeeded by laregexp.
+# Only regexp get's replaced, the matches of lbregexp and laregexp are left
+# as-is. Overlapping of any form isn't supported.
+# This function is quite slow, try to use as little as possible.
+# Returns the result string, rather than doing it inplace.
function glsub(lbregexp, regexp, laregexp, replacement, target) {
if (!length(target)) {
target = $0;