fix regexp parsing and output