added regex to determine a function