From 2e80d64aaecf8eaf3bbd37387d3f7e08a2f8da85 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Sat, 17 Jan 2015 22:49:34 -0500 Subject: [PATCH] Update documentation --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 1a4b49fdd3..da9e62f4b4 100644 --- a/README.md +++ b/README.md @@ -116,3 +116,15 @@ Perl and Javascript use. `"12".split(re"(\d)") == @["", "1", "", "2", ""]`. [proc-split]: #splitstring-regex-seqstring + +#### `replace(string, Regex, sub): string` + +Replaces each match of Regex in the string with `sub`. If `sub` is a `proc +(RegexMatch): string`, then it is executed with each match and the return value +is the replacement value. + +If `sub` is a string, then each match is replaced with that string, where the +captures are accessable as `$1`, `$2`, and so on. A literal `$` can be added by +doubling up like so: `$$`. + +[proc-replace]: #replacestring-regex-sub-string