Updated regex and parsing of imem