* Improved pattern handling for format detection