Looking for simple pattern/algorithm to parse text with tokens
i have several tamplets text in this tamplets text i have tokens that represent some actions
i need to do ( usually replace it with different string ) when i process the text in my application
the actions i need to do based on the tokens in the string will be activate from different sources
for example if token called @_db_name_@ will be found in the application i will know
i need to replace it with name coming out from the DB , and if i will find the token @_calc_id_@
in the application i will know i need to calculate the id of the object based on X and Y
im looking for common pattern or algorithm that will help me to do it more generic .