Java interview with a Google engineer: Regex matching