1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-07 15:26:45 +02:00

Merge pull request #4441 from nbehrnd/awk-es

correct example of gsub in awk-es
This commit is contained in:
Marcel Ribeiro Dantas, Ph.D
2022-07-11 20:25:27 +02:00
committed by GitHub

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