Add support for thread numbers

Some thread headers come with a "#10" field, for different values of "10".

In this change we rewrite the thread header parser to make it more
maintainable.

Instead of having one long regex, we now remove one item at a time
from the thread header, using one regex per item.

So rather than having one huge regex that's impossible to work with,
we now have about ten small ones that are easy to work with.