fix function regex and simplify comment regex