Improve Resub API.

Hold the subexpression count and array of matches inside a struct.