fixed handling of regex