tweaked set_timeout() to not assume sub_ref
updated unit test for validate_regex