diff options
1 files changed, 7 insertions, 1 deletions
| -rw-r--r-- | awk-edits/#strings.awk | 8 |
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; |