mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 07:04:29 +00:00
Add tests for string match/replace --max-matches
This commit is contained in:
parent
f975e1c9e5
commit
8b7597913e
1 changed files with 14 additions and 0 deletions
|
@ -1148,3 +1148,17 @@ string shorten abc \aabc ab abcdef | string escape
|
|||
# CHECK: \cga…
|
||||
# CHECK: ab
|
||||
# CHECK: a…
|
||||
|
||||
printf "dog\ncat\nbat\ngnat\n" | string match -m2 "*at"
|
||||
# CHECK: cat
|
||||
# CHECK: bat
|
||||
|
||||
printf "dog\ncat\nbat\nhog\n" | string match -rvm1 'at$'
|
||||
# CHECK: dog
|
||||
|
||||
printf "dog\ncat\nbat\n" | string replace -rf --max-matches 1 'at$' 'aught'
|
||||
# CHECK: caught
|
||||
|
||||
printf "dog\ncat\nbat\n" | string replace -r --max-matches 1 '^c' 'h'
|
||||
# CHECK: dog
|
||||
# CHECK: hat
|
||||
|
|
Loading…
Reference in a new issue