diff --git a/c/reg_test/expected/out b/c/reg_test/expected/out index d9398048f..b86d94970 100644 --- a/c/reg_test/expected/out +++ b/c/reg_test/expected/out @@ -4162,6 +4162,51 @@ HELLO HELLO world world WORLD WORLD +mlr --opprint put $y = sub($x, "a", "aa") ./reg_test/input/gsub.dat +x y +lmnop lmnop +abcdefg aabcdefg +ababbabbba aababbabbba +LMNOP LMNOP +ABCDEFG ABCDEFG +ABABBABBBA ABABBABBBA + +mlr --opprint put $y = gsub($x, "a", "aa") ./reg_test/input/gsub.dat +x y +lmnop lmnop +abcdefg aabcdefg +ababbabbba aabaabbaabbbaa +LMNOP LMNOP +ABCDEFG ABCDEFG +ABABBABBBA ABABBABBBA + +mlr --opprint put $y = gsub($x, "A", "Aa") ./reg_test/input/gsub.dat +x y +lmnop lmnop +abcdefg abcdefg +ababbabbba ababbabbba +LMNOP LMNOP +ABCDEFG AaBCDEFG +ABABBABBBA AaBAaBBAaBBBAa + +mlr --opprint put $y = gsub($x, "a"i, "Aa") ./reg_test/input/gsub.dat +x y +lmnop lmnop +abcdefg Aabcdefg +ababbabbba AabAabbAabbbAa +LMNOP LMNOP +ABCDEFG AaBCDEFG +ABABBABBBA AaBAaBBAaBBBAa + +mlr --opprint put $y = gsub($x, "A"i, "Aa") ./reg_test/input/gsub.dat +x y +lmnop lmnop +abcdefg Aabcdefg +ababbabbba AabAabbAabbbAa +LMNOP LMNOP +ABCDEFG AaBCDEFG +ABABBABBBA AaBAaBBAaBBBAa + ================================================================ CHAINING diff --git a/doc/reference.html b/doc/reference.html index 5ba45400b..8001c2355 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -239,9 +239,9 @@ Functions for filter and put: abs acos acosh asin asinh atan atan2 atanh cbrt ceil cos cosh erf erfc exp expm1 floor invqnorm log log10 log1p max min pow qnorm round roundm sin sinh sqrt tan tanh urand + - - * / % ** =~ !=~ == != > >= < <= && || ! strlen sub - tolower toupper . boolean float int string hexfmt fmtnum systime sec2gmt - gmt2sec sec2hms sec2dhms hms2sec dhms2sec fsec2hms fsec2dhms hms2fsec - dhms2fsec + gsub tolower toupper . boolean float int string hexfmt fmtnum systime + sec2gmt gmt2sec sec2hms sec2dhms hms2sec dhms2sec fsec2hms fsec2dhms + hms2fsec dhms2fsec Please use "mlr --help-function {function name}" for function-specific help. Please use "mlr --help-all-functions" or "mlr -f" for help on all functions. @@ -2476,7 +2476,8 @@ urand (math: #args=0): Floating-point numbers on the unit interval. I || (boolean: #args=2): Logical OR. ! (boolean: #args=1): Logical negation. strlen (string: #args=1): String length. -sub (string: #args=3): Example: '$name=sub($name, "old", "new")'. Regexes not supported. +sub (string: #args=3): Example: '$name=sub($name, "old", "new")' (replace once). +gsub (string: #args=3): Example: '$name=gsub($name, "old", "new")' (replace all). tolower (string: #args=1): Convert string to lowercase. toupper (string: #args=1): Convert string to uppercase. . (string: #args=2): String concatenation.