diff --git a/tests/string.err b/tests/string.err index d291768ce..478007e2d 100644 --- a/tests/string.err +++ b/tests/string.err @@ -176,6 +176,9 @@ #################### # string replace --regex -f "\d" X 1bc axc 2 d3f jk4 xyz +#################### +# string match -r with empty capture groups + #################### # string match -r "[" "a[sd" string match: Regular expression compile error: missing terminating ] for character class diff --git a/tests/string.in b/tests/string.in index e15f33ee5..7bb386d0e 100644 --- a/tests/string.in +++ b/tests/string.in @@ -203,6 +203,10 @@ or echo Unexpected exit status at line (status --current-line-number) string replace --regex -f "Z" X 1bc axc 2 d3f jk4 xyz and echo Unexpected exit status at line (status --current-line-number) +# From https://github.com/fish-shell/fish-shell/issues/5201 +logmsg 'string match -r with empty capture groups' +string match -r '^([ugoa]*)([=+-]?)([rwx]*)$' '=r' + # test some failure cases logmsg 'string match -r "[" "a[sd"' string match -r "[" "a[sd"; and echo "unexpected exit 0" diff --git a/tests/string.out b/tests/string.out index 2fdec3025..bdd0cb568 100644 --- a/tests/string.out +++ b/tests/string.out @@ -274,6 +274,13 @@ X dXf jkX +#################### +# string match -r with empty capture groups +=r + += +r + #################### # string match -r "[" "a[sd"