<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def regex_to_error_msg(regex):
 """Format a human-readable error message from a regex"""

    return re.sub('([^\\\\])[()]', '\\1', regex) \
        .replace('[ \t]*$', '') \
        .replace('^', '') \
        .replace('$', '') \
        .replace('[ \t]*', ' ') \
        .replace('[ \t]+', ' ') \
        .replace('[0-9]+', 'X') \
        \
        .replace('\\[', '[') \
        .replace('\\]', ']') \
        .replace('\\(', '(') \
        .replace('\\)', ')') \
        .replace('\\.', '.')