mostly replace slow regexpr with regex-tdfa (fixes #189)