nushell/crates/nu-command
Antoine Stevan bb30051006
add a "capture" example to str replace, before the fancy ones (#9447)
closes https://github.com/nushell/nushell/issues/9437
cc/ @Sygmei 😉 

# Description
the syntax of *captures* used in `str replace` can be confusing for
people not used to the `regex` syntax.
there is already a capture example in `help str replace`
```bash
  Find and replace with fancy-regex
  > 'a successful b' | str replace '\b([sS])uc(?:cs|s?)e(ed(?:ed|ing|s?)|ss(?:es|ful(?:ly)?|i(?:ons?|ve(?:ly)?)|ors?)?)\b' '${1}ucce$2'
  a successful b
```
but it's really not trivial to understand the *capture* syntax...

this PR adds a simpler example only focused on *captures*
🥳
```bash
  Use captures to manipulate the input text
  > "abc-def" | str replace "(.+)-(.+)" "${2}_${1}"
  def_abc
```

# User-Facing Changes
an example in `help str replace` to understand the syntax of *captures*.

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
-  `toolkit test`
-  `toolkit test stdlib`

# After Submitting
```
$nothing
```
2023-06-16 13:23:44 -05:00
..
assets refactor html module (#5246) 2022-04-20 08:50:14 -05:00
src add a "capture" example to str replace, before the fancy ones (#9447) 2023-06-16 13:23:44 -05:00
tests Fix a panic bug in platform ansi logic (Closes #9448) (#9458) 2023-06-16 11:40:03 -05:00
Cargo.toml Break up interdependencies of command crates (#9429) 2023-06-14 23:12:55 +02:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00