Use smartmatch instead of regex for functions