import re


def process_ex_cmd(tag):
    """
    Process the 'ex_command' element of a tag dictionary.

    Process the ex_command string - a line number or regex used to find symbol
    declaration - by unescaping the regex where used.

    :param tag: dict containing a tag

    :returns: updated 'ex_command' dictionary entry
    """
    ex_cmd = tag.get('ex_command')

    if ex_cmd.isdigit():  # if a line number, do nothing
        return ex_cmd
    else:                 # else a regex, so unescape
        return re.sub(r"\\(\$|/|\^|\\)", r'\1', ex_cmd[2:-2])