reimplementation

more tests, better regexp

updated doc