Fix regex and add tests