import re


def stripcomments(lines):
    """
    Strips all C++ style block and line comments from a list of lines using RegEx
    """

    def replacer(match):
        s = match.group(0)
        if s.startswith('/'):
            return ""
        else:
            return s

    pattern = re.compile(
        r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
        re.DOTALL | re.MULTILINE
    )
    out_lines = []
    for line in lines:
        line = re.sub(pattern, replacer, line).strip()
        out_lines.append(line)

    return out_lines