def removeComments(string):
    string = re.sub(re.compile('/\\*.*?\\*/', re.DOTALL), '', string)
string = re.sub(re.compile('//.*?\n'), '', string)
return string
Using regex to remove comments from source files