added tests; fixed some regexes;