I think this code would be clearer if the regex's were stored in consts higher up with examples of what one looks like as comments.