From a929b4825ad5daca1c6b190c9aac37b27e0341cb Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Mon, 19 Jan 2015 10:16:40 -0500 Subject: [PATCH] Clarify replace() syntax --- README.asciidoc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 51f616b4e5..b7f0ba66f7 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -75,9 +75,15 @@ 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: `$$`. +If `sub` is a string, the syntax is as follows: + +- `$$` - literal `$` +- `$123` - capture number `123` +- `$foo` - named capture `foo` +- `${foo}` - same as above +- `$1$#` - first and second captures +- `$#` - first capture +- `$0` - full match [[proc-escapere]] ==== escapeRe(string): string