prevent crash if invalid regexp is passed