stringtemplate extract variables matching pattern

302 Views Asked by At

I am using the stringtemplate library for templating in a c# application. I am looking for a feature like so,

given a template like "$address1$, $address2, $PIN$" and a string like "Nightmare, elm street, 666666"

I would like to extract the values that template variables could have matched

address1 = Nightmare

address2 = elm street

PIN = 666666

is it possible to use stringtemplate? any other alternate suggestions if not?

1

There are 1 best solutions below

0
On

It would be better to put that logic into whatever populates the model provided to stringtemplate. The job of stringtemplate is to populate templates, not to perform parsing logic.