What’s the easiest and fastest way to find a sub-string(template) in a string and replace it with something else following the template’s letter case (if all lower case – replace with lowercase, if all upper case – replace with uppercase, if begins with uppercase and so on…)
so if the substring is in curly braces
"{template}" becomes "replaced content"
"{TEMPLATE}" becomes "REPLACED CONTENT" and
"{Template}" becomes "Replaced content" but
"{tEMPLATE}" becomes "rEPLACED CONTENT"
Ended up doing that: