fixes #11: produce only valid RegExps