docs/string: Add a -- example to the match section

This keeps tripping people up. We can't mention it *everywhere*, but
lets see if it works just in "match", since that sees to be where
people hit it most.
This commit is contained in:
Fabian Boehm 2023-01-05 15:55:28 +01:00
parent 15939be56c
commit 9e1c8a70bf

View file

@ -59,6 +59,12 @@ Match Glob Examples
>_ string match -i 'a??B' Axxb
Axxb
>_ string match -- '-*' -h foo --version bar
# To match things that look like options, we need a `--`
# to tell string its options end there.
-h
--version
>_ echo 'ok?' | string match '*\?'
ok?
@ -91,6 +97,12 @@ Match Regex Examples
cat4
dog4
>_ string match -r -- '-.*' -h foo --version bar
# To match things that look like options, we need a `--`
# to tell string its options end there.
-h
--version
>_ string match -r '(\d\d?):(\d\d):(\d\d)' 2:34:56
2:34:56
2