`obj` should probably be named `regex` or `regex_str` to be a little clearer.

Also the function name doesn't really need an underscore and should probably be named more like the action it takes, like `validate_regex`.