Use regular expressions for expanding templates

Previously the `Data elements had leading and trailing whitespace
and additional text ("openmirage :: $TITLE$") which means we need
something stronger than List.assoc.