Fix multiple bugs

Improve regex to handle patterns correctly
Fix handling and rendering of coefficients
Improve test text