wrap RegExp generation in try/catch just in case we gen an invalid one