Use slices instead of regexp
Add tests for edge cases
Add more formats, remove regexp