If php is built without USE=pcre, cacti fails with "Fatal error: Call to undefined function preg_match() in .../cacti/lib/data_query.php on line 116" I've only tested this with net-analyzer/cacti-0.8.6j-r5, but previous versions are probably also affected.
Thank you for report, Andrew. Fixed in cacti-0.8.6j-r6 (no revision bump since cacti does not work at all if they are disabled and besides pcre and session are upstream suggested USE flags). BTW, I've also checked and found that besides pcre cacti requires session USE flag which was added too.