Generic generate C extension method
Support regex patterns