templates: experiment using templates for complex building regex script

Signed-off-by: Peter Williams <pwil3058@gmail.com>