Regex refactor

* Fixes #9 
* Improves tests #4