use perl regex to fix function match bug