> Is there some equivalent feature in Python regexps?

cpp_pat = re.compile('(/\*.*?\*/)|(".*?")', re.S)

def subfunc(match):
  if match.group(2):
    return match.group(2)
  else:
    return ''

stripped_c_code = cpp_pat.sub(subfunc, c_code)


...I suppose this is what the Perl code might do, but I'm not sure,
since trying to read it hurts my brain...

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to