Write a function to parse and validate complex input strings, ensuring you handle edge cases, malformed data, and unexpected characters.