nushell/crates/nu-command/src/strings
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
..
encode_decode Decode and Encode hex (#8392) 2023-03-24 12:25:26 +01:00
format Fix internal module reexports (#9378) 2023-06-07 16:36:34 +02:00
split Add "regex" search term to commands with regex functionality (#9402) 2023-06-11 00:02:00 +02:00
str_ add a "capture" example to str replace, before the fancy ones (#9447) 2023-06-16 13:23:44 -05:00
char_.rs Revert numberlike parsing restriction (#8845) 2023-04-12 05:21:31 +12:00
detect_columns.rs Uniformize usage() and extra_usage() message ending for commands helper. (#8268) 2023-02-28 21:33:02 -08:00
mod.rs Document and critically review ShellError variants - Ep. 2 (#8326) 2023-03-06 11:31:07 +01:00
parse.rs Add "regex" search term to commands with regex functionality (#9402) 2023-06-11 00:02:00 +02:00
size.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00