Parse Email Addresses from a Log String

Asked at Microsoft · Coding Questions · Difficulty: Medium · Last asked Feb 1, 2026

A log line holds many email records separated by semicolons. A record can carry a display name in quotes, notes in parentheses, or an address in angle brackets, and quotes and parentheses may themselves contain semicolons. Write a function that returns every distinct valid address in the line, in the order each one first appears.

Loading the problem…