mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 01:30:21 -07:00
doc: clarify capture group indices
And in particular, note the special $0 index, which corresponds to the entire match. Fixes #1591
This commit is contained in:
parent
b72ad8f8aa
commit
a700b75843
@ -6,6 +6,8 @@ Bug fixes:
|
|||||||
|
|
||||||
* [BUG #1581](https://github.com/BurntSushi/ripgrep/issues/1581):
|
* [BUG #1581](https://github.com/BurntSushi/ripgrep/issues/1581):
|
||||||
Corrects some egregious markup output in `--help`.
|
Corrects some egregious markup output in `--help`.
|
||||||
|
* [BUG #1591](https://github.com/BurntSushi/ripgrep/issues/1591):
|
||||||
|
Mention the special `$0` capture group in docs for the `-r/--replace` flag.
|
||||||
|
|
||||||
|
|
||||||
12.1.0 (2020-05-09)
|
12.1.0 (2020-05-09)
|
||||||
|
@ -2576,10 +2576,13 @@ Replace every match with the text given when printing results. Neither this
|
|||||||
flag nor any other ripgrep flag will modify your files.
|
flag nor any other ripgrep flag will modify your files.
|
||||||
|
|
||||||
Capture group indices (e.g., $5) and names (e.g., $foo) are supported in the
|
Capture group indices (e.g., $5) and names (e.g., $foo) are supported in the
|
||||||
replacement string. In shells such as Bash and zsh, you should wrap the
|
replacement string. Capture group indices are numbered based on the position of
|
||||||
pattern in single quotes instead of double quotes. Otherwise, capture group
|
the opening paranthesis of the group, where the leftmost such group is $1. The
|
||||||
indices will be replaced by expanded shell variables which will most likely
|
special $0 group corresponds to the entire match.
|
||||||
be empty.
|
|
||||||
|
In shells such as Bash and zsh, you should wrap the pattern in single quotes
|
||||||
|
instead of double quotes. Otherwise, capture group indices will be replaced by
|
||||||
|
expanded shell variables which will most likely be empty.
|
||||||
|
|
||||||
To write a literal '$', use '$$'.
|
To write a literal '$', use '$$'.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user