import re


def strip_comments(source_code):
    """
    Strips comments from source code to increase analysis accuracy.

    The function is similar to strip_quotations. It removes all comments
    from the source_code. It is also used to prevent false positives.
    It uses a regex to match and remove line comments and then block comments.

    :param source_code: the string that contains source code
    :return: same source code as source but without any comments
    """
    line_comment_regex = "\\/\\/.*\\n"
    block_comment_regex = "\\/\\*(.|[\\r\\n])*?\\*\\/"
    line_comments_removed = re.sub(line_comment_regex, "\n", source_code)
    all_comments_removed = re.sub(block_comment_regex, "\n", line_comments_removed)
    return all_comments_removed