Seems like the wrong scope to add this to re. Something more generic along the lines of
with timeout(0.5):
m = re.search(user_pattern, user_text)
where the timeout context manager raises an exception if it takes too long would be more appropriate. How this interacts with SIGSTOP etc is up to you.