When there are no captures, `expr STRING : REGEXP` is supposed to print the length of the match, or “0” for no match. Then it exits with 0 if there was a match, or 1 if there wasn’t.

When there are captures, it’s supposed to print the first capture instead. Same exit codes.