mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
e160cde606
Closes #5309.
315 lines
6.5 KiB
Plaintext
315 lines
6.5 KiB
Plaintext
|
|
####################
|
|
# string match -r -v "c.*" dog can cat diz
|
|
|
|
####################
|
|
# string match -q -r -v "c.*" dog can cat diz
|
|
|
|
####################
|
|
# string match -v "c*" dog can cat diz
|
|
|
|
####################
|
|
# string match -q -v "c*" dog can cat diz
|
|
|
|
####################
|
|
# string match -v "d*" dog dan dat diz
|
|
|
|
####################
|
|
# string match -q -v "d*" dog dan dat diz
|
|
|
|
####################
|
|
# string match -r -v x y
|
|
|
|
####################
|
|
# string match -r -v x x
|
|
|
|
####################
|
|
# string match -q -r -v x y
|
|
|
|
####################
|
|
# string match -q -r -v x x
|
|
|
|
####################
|
|
# string length "hello, world"
|
|
|
|
####################
|
|
# string length -q ""
|
|
|
|
####################
|
|
# string sub --length 2 abcde
|
|
|
|
####################
|
|
# string sub -s 2 -l 2 abcde
|
|
|
|
####################
|
|
# string sub --start=-2 abcde
|
|
|
|
####################
|
|
# string split . example.com
|
|
|
|
####################
|
|
# string split -r -m1 / /usr/local/bin/fish
|
|
|
|
####################
|
|
# string split "" abc
|
|
|
|
####################
|
|
# seq 3 | string join ...
|
|
|
|
####################
|
|
# string trim " abc "
|
|
|
|
####################
|
|
# string trim --right --chars=yz xyzzy zany
|
|
|
|
####################
|
|
# echo \x07 | string escape
|
|
|
|
####################
|
|
# string escape --style=script 'a b#c"\'d'
|
|
|
|
####################
|
|
# string escape --style=url 'a b#c"\'d'
|
|
|
|
####################
|
|
# string escape --style=url \na\nb%c~d\n
|
|
|
|
####################
|
|
# string escape --style=var 'a b#c"\'d'
|
|
|
|
####################
|
|
# string escape --style=script a\nghi_
|
|
|
|
####################
|
|
# string escape --style=var 'abc'
|
|
|
|
####################
|
|
# string escape --style=var '_a_b_c_'
|
|
|
|
####################
|
|
# string escape --style=var -- -
|
|
|
|
####################
|
|
# string escape with multibyte chars
|
|
|
|
####################
|
|
# string escape for literal pcre2 searching
|
|
|
|
####################
|
|
# set x (string unescape (echo \x07 | string escape))
|
|
|
|
####################
|
|
# string unescape --style=script (string escape --style=script 'a b#c"\'d')
|
|
|
|
####################
|
|
# string unescape --style=url (string escape --style=url 'a b#c"\'d')
|
|
|
|
####################
|
|
# string unescape --style=url (string escape --style=url \na\nb%c~d\n)
|
|
|
|
####################
|
|
# string unescape --style=var (string escape --style=var 'a b#c"\'d')
|
|
|
|
####################
|
|
# string unescape --style=var (string escape --style=var a\nghi_)
|
|
|
|
####################
|
|
# string unescape --style=var (string escape --style=var 'abc')
|
|
|
|
####################
|
|
# string unescape --style=var (string escape --style=var '_a_b_c_')
|
|
|
|
####################
|
|
# string unescape --style=var (string escape --style=var -- -)
|
|
|
|
####################
|
|
# string match "*" a
|
|
|
|
####################
|
|
# string match "a*b" axxb
|
|
|
|
####################
|
|
# string match -i "a**B" Axxb
|
|
|
|
####################
|
|
# echo "ok?" | string match "*?"
|
|
|
|
####################
|
|
# string match -r "cat|dog|fish" "nice dog"
|
|
|
|
####################
|
|
# string match -r "(\d\d?):(\d\d):(\d\d)" 2:34:56
|
|
|
|
####################
|
|
# string match -r "^(\w{2,4})\g1\$" papa mud murmur
|
|
|
|
####################
|
|
# string match -r -a -n at ratatat
|
|
|
|
####################
|
|
# string match -r -i "0x[0-9a-f]{1,8}" "int magic = 0xBadC0de;"
|
|
|
|
####################
|
|
# string replace is was "blue is my favorite"
|
|
|
|
####################
|
|
# string replace 3rd last 1st 2nd 3rd
|
|
|
|
####################
|
|
# string replace -a " " _ "spaces to underscores"
|
|
|
|
####################
|
|
# string replace -r -a "[^\d.]+" " " "0 one two 3.14 four 5x"
|
|
|
|
####################
|
|
# string replace -r "(\w+)\s+(\w+)" "\$2 \$1 \$\$" "left right"
|
|
|
|
####################
|
|
# string replace -r "\s*newline\s*" "\n" "put a newline here"
|
|
|
|
####################
|
|
# string replace -r -a "(\w)" "\$1\$1" ab
|
|
|
|
####################
|
|
# string replace --filter x X abc axc x def jkx
|
|
|
|
####################
|
|
# string replace --regex -f "\d" X 1bc axc 2 d3f jk4 xyz
|
|
|
|
####################
|
|
# string match -r "[" "a[sd"
|
|
string match: Regular expression compile error: missing terminating ] for character class
|
|
string match: [
|
|
string match: ^
|
|
|
|
####################
|
|
# string invalidarg
|
|
string: Subcommand 'invalidarg' is not valid
|
|
Standard input (line 211):
|
|
string invalidarg; and echo "unexpected exit 0"
|
|
^
|
|
|
|
####################
|
|
# string length
|
|
|
|
####################
|
|
# string match -r -v "[dcantg].*" dog can cat diz
|
|
|
|
####################
|
|
# string match -v "*" dog can cat diz
|
|
|
|
####################
|
|
# string match -rvn a bbb
|
|
|
|
####################
|
|
# string repeat -n 2 "foo"
|
|
|
|
####################
|
|
# string repeat --count 2 "foo"
|
|
|
|
####################
|
|
# echo foo | string repeat -n 2
|
|
|
|
####################
|
|
# string repeat -n2 -q "foo"
|
|
|
|
####################
|
|
# string repeat -n2 --quiet "foo"
|
|
|
|
####################
|
|
# string repeat -n0 "foo"
|
|
|
|
####################
|
|
# string repeat -n0
|
|
|
|
####################
|
|
# string repeat -m0
|
|
|
|
####################
|
|
# string repeat -n1 -N "there is "
|
|
|
|
####################
|
|
# string repeat -n1 --no-newline "there is "
|
|
|
|
####################
|
|
# string repeat -n10 -m4 "foo"
|
|
|
|
####################
|
|
# string repeat -n10 --max 5 "foo"
|
|
|
|
####################
|
|
# string repeat -n3 -m20 "foo"
|
|
|
|
####################
|
|
# string repeat -m4 "foo"
|
|
|
|
####################
|
|
# string repeat -n-1 "foo"
|
|
string repeat: Invalid count value '-1'
|
|
|
|
####################
|
|
# string repeat -m-1 "foo"
|
|
string repeat: Invalid max value '-1'
|
|
|
|
####################
|
|
# string repeat -n notanumber "foo"
|
|
string repeat: Argument 'notanumber' is not a number
|
|
|
|
####################
|
|
# string repeat -m notanumber "foo"
|
|
string repeat: Argument 'notanumber' is not a number
|
|
|
|
####################
|
|
# echo "stdin" | string repeat -n1 "and arg"
|
|
string repeat: Too many arguments
|
|
|
|
####################
|
|
# string repeat -n
|
|
string repeat: Expected argument
|
|
|
|
####################
|
|
# string repeat -l fakearg 2>&1
|
|
string repeat: Unknown option '-l'
|
|
Standard input (line 287):
|
|
string repeat -l fakearg
|
|
^
|
|
|
|
####################
|
|
# string repeat ""
|
|
|
|
####################
|
|
# string repeat -n3 ""
|
|
|
|
####################
|
|
# string match -e x abc dxf xyz jkx x z
|
|
|
|
####################
|
|
# string match x abc dxf xyz jkx x z
|
|
|
|
####################
|
|
# string match --entire -r "a*b[xy]+" abc abxc bye aaabyz kaabxz abbxy abcx caabxyxz
|
|
|
|
####################
|
|
# string match --entire "" -- banana
|
|
|
|
####################
|
|
# string match -r "a*b[xy]+" abc abxc bye aaabyz kaabxz abbxy abcx caabxyxz
|
|
|
|
####################
|
|
# string match --entire -r "a*b([xy]+)" abc abxc bye aaabyz kaabxz abbxy abcx caabxyxz
|
|
|
|
####################
|
|
# string match -r "a*b([xy]+)" abc abxc bye aaabyz kaabxz abbxy abcx caabxyxz
|
|
|
|
####################
|
|
# Check NUL
|
|
|
|
####################
|
|
# string split0
|
|
|
|
####################
|
|
# string join0
|
|
|
|
####################
|
|
# string split0 in functions
|