improve regex, change docs, add tests