The docs are pretty complete, but not very helpful with respect to examples. I wasn't able to find very many useful examples on google, but the API docs are quite good. What wasn't answered by the docs was answered by reading header files. Excellent.
The result of this adventure is this:
# regex: ^(?<test>.*?)( (?<word2>.*))?$ # input: "hello there" % gcc -I/usr/local/include -L/usr/local/lib -lonig oniguruma_named_captures.c % ./a.out "hello there" word2 = there test = hello % ./a.out "foobarbazfizz" word2 = test = foobarbazfizz