test results, Solaris, lightly edited for appearance
    (similar behavior on Linux and Mac OS X with GCC)

% cc -v regex-2.c

% cat in
defabcwxyzabc

% a.out < in
usage: a.out pattern
   reads from stdin, reports matches

% a.out abc < in
match: "abc"
defabcwxyzabc
01234567890123456789

start of first example
yes
end of first example

start of second example
regcomp() ok
1 error = 0, start + pm = 3, 6
2 error = 0, start + pm = 10, 13
2 regexec failed: failed to match
end of second example

%