Mohammad,
As is commonly the case, especially in TiddlyWiki, it is important to return to why we are asking to do something. It is actually very common for people to think search and replaces is the answer when another solution may be more valid. In part because a manual search and replace is easier for one or two cases, automated replacements re a better solution for multiple cases, so automating search and replace is not often overly useful.
This does not replace the feature you are looking for, it just potentially diminishes the value, or number of occasions it may be needed.
<$set name=first-name value="Mohammad">
<$set name=last-name value="TheMan">
<$set name=birthday value="26/12">
<$set name=salution value="Sir">
<$transclude tiddler="letter-template"/>
</$set></$set></$set>
letter-template
Dear <<salutation>> <<first-name>> <<last-name>>,
We are aware your birthday is on the <<birthday>> and would like to give you the following gift, <<giftname>>
...
The key to making such productivity gains with TiddlyWiki is to always be thinking of how you can capture and represent data in the first place in a way that future retrofit or customisation is easier.
I applaud your building the tools for such retrofit, but also think it is important to avoid such a need in the first place. In this example if we foresaw the need to search and replace something more than once, we can consider if we should construct our template instead. If it is only once, manual change is cheap and practical.
By the way, if you had not thought of the need to change those values when you first wrote the tiddler, perhaps when you identify you need to search and replaces rather than change the literal value, change it to a variable instead.
So Search for "Mohammad" and replace with <<first-name>>
or perhaps "Mohammad" and replace with {{!!first-name}}
would be the optimum approach.
So perhaps you can ensure any search and replace solution is tolerant of Variables and text references, perhaps even substitution variables $param$ $(variable)$
Regards
Tony