import re


def reg_ex(s_input: str) -> str:
    """
    Used for parsing some inputs to this program, namely regular expressions given as input.
    Whitespace is removed, but no case-changing occurs.

    :param s_input: String passed in by argparse

    :return str: The regular expression
    """
    stripped_regex = s_input.strip()
    try:
        re.compile(stripped_regex)
    except re.error as exc:
        raise RuntimeError("Invalid regular expression \"%s\" supplied: %s" %
                           (stripped_regex, exc)) from exc

    return stripped_regex