Refactor log line regex matching