Match a Regex against a (presumed UTF-8 encoded) ByteString,
returning the matched text and a map of (offset, size)
pairs for captures. Note that all matches are from the
beginning of the string (a ^ anchor is implicit). Note
also that to avoid pathological performance in certain cases,
the matcher is limited to considering 2000 possible matches
at a time; when that threshold is reached, it discards
smaller matches. Hence certain regexes may incorrectly fail to
match: e.g. a*a{3000}$ on a string of 3000 as.