Small optimizations to parseMessage()

Replaced capturing groups with non-capturing groups when their match isn't used, and removed redundant capturing groups.