Added support for multi-line regex matches and formatting.