Yup, the only way would be to parse a possible list of alternatives. Should be simple with parsing libraries like parsec.

    try format1 <|> try format2 <|> ...

Regards,
  Sumit