Add a pregsprintf function
Summary: See rP14507dc64bf42373e627a90016cd63f06e82e19b.
Test Plan: Added unit tests.
Reviewers: epriestley, Blessed Reviewers
Reviewed By: epriestley, Blessed Reviewers
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D12310