correct example of gsub in awk-es

Edit is based on the correction in the English edition.[1]

[1] https://github.com/adambard/learnxinyminutes-docs/pull/4437
This commit is contained in:
Norwid Behrnd 2022-07-11 14:59:38 +02:00
parent 1ff2927250
commit 0b6ac01abe

View File

@ -196,7 +196,7 @@ function string_functions( localvar, arr) {
# Ambas regresan el número de matches remplazados.
localvar = "fooooobar"
sub("fo+", "Meet me at the ", localvar) # localvar => "Meet me at the bar"
gsub("e+", ".", localvar) # localvar => "m..t m. at th. bar"
gsub("e", ".", localvar) # localvar => "m..t m. at th. bar"
# Buscar una cadena que haga match con una expresión regular
# index() hace lo mismo, pero no permite expresiones regulares