The stdlib net/http package already has code to parse the "Content-Range" header.
The golang.org/x/net/webdav package wants to handle "Content-Range", and is considering rolling its own parser, regexp-based or otherwise: https://go-review.googlesource.com/c/net/+/128115
The proposal is to export net/http's httpRange (and its fields, obviously) and parseRange, possibly renaming them to ContentRange and ParseContentRange.
If we do that, we might want to consider tightening the semantics or expectations of the httpRange's start and length int64-typed fields. For example, what happens in its various methods if start + length overflows or if some field values are negative.
@bradfitz
Elsewhere I'd said we could move it to x/net's httpguts package. That's fine.
httpguts sounds perfect.
Most helpful comment
Elsewhere I'd said we could move it to x/net's httpguts package. That's fine.