General parsing with regex