It would be useful to have a function to scan the user macros. I have currently implemented this using the external item type and a script accessing the Zabbix API.
Use case: I have developed a template to check the validity of SSL-certificates regarding the end date of validity and if the certificate was issued by a specific issuer. The problem was that nowadays many hosts have more than one of these certificates deployed to many different ports, not only port 443.
I have currently solved this using an external item discovery that scans the host for user macros named xxxxSSL_PORT and xxxxSSL_ISSUER; these are matched into a JSON array usable for LLD-discovery.
If there was a function available for scanning macros this might be turned into a calculated item type without the dependance on external scripts.