Hey @wogo,
Thank you for explaining; that makes perfect sense.
For this kind of job I usually employ the Satimage.osax AppleScript Extension.
http://satimage.fr/software/en/downloads/downloads_nextsmile.html
The Satimage.osax has the advantage of being fully Unicode-compliant – is easy to use – and is quite versatile.
------------------------------------------------------------------------------
#### Requires Installation of the Satimage.osax AppleScript Extension ####
------------------------------------------------------------------------------
set someText to "Now is the time for all good men to come to the aid of their country."
# Regular Expression:
set newtext to change "(N|t)\\w+" into "•••" in someText with regexp without case sensitive
--> "••• is ••• ••• for all good men ••• come ••• ••• aid of ••• cou•••."
# Literal Text:
set newtext to change "Now" into "Who" in someText
--> "Who is the time for all good men to come to the aid of their country."
# Groups of Literal Text
set newtext to change {"N", "o", "w", "men"} into {"W", "h", "o", "women"} in someText
--> "Who is the time fhr all ghhd women th chme th the aid hf their chuntry."
------------------------------------------------------------------------------
On my system I use a handler to make the calls a little less verbose:
The syntax of the call:
set someText to cng("findPattern", "replacePattern", dataVariable) of me
What a script with it looks like:
------------------------------------------------------------------------------
set someText to "Now is the time for all good men to come to the aid of their country."
# Regular Expression:
set newtext to cng("(N|t)\\w+", "•••", someText) of me
------------------------------------------------------------------------------
--» HANDLERS
------------------------------------------------------------------------------
on cng(_find, _replace, _data)
change _find into _replace in _data with regexp without case sensitive
end cng
------------------------------------------------------------------------------
Now we'll work with the clipboard:
------------------------------------------------------------------------------
set someText to the clipboard
set newtext to cng("(N|t)\\w+", "•••", someText) of me
# Add more "cng" statements as needed...
------------------------------------------------------------------------------
--» HANDLERS
------------------------------------------------------------------------------
on cng(_find, _replace, _data)
change _find into _replace in _data with regexp without case sensitive
end cng
------------------------------------------------------------------------------
From here we can set the clipboard to the massaged data, or we can output to a variety of scriptable applications or a file.
If you run a compiled-script instead of a text-script you can open it in the Script Editor.app (or Script Debugger if you have it).
This offers greater flexibility while testing and offers a better editing experience complete with find/replace.
I believe you mentioned you might like to have dynamic options based on the clipboard content.
AppleScript + the Satimage.osax will give you many options in that regard, and you should be able to learn how to do quite a lot for yourself without too much study.
Here's a trivial example:
------------------------------------------------------------------------------
set the clipboard to "What is the meaing of הָאֱמֶת?"
set someText to the clipboard
if someText contains "הָאֱמֶת" then
set newText to cng("הָאֱמֶת", "emet", someText) of me
end if
------------------------------------------------------------------------------
--» HANDLERS
------------------------------------------------------------------------------
on cng(_find, _replace, _data)
change _find into _replace in _data with regexp without case sensitive
end cng
------------------------------------------------------------------------------
Much more sophisticated things are possible of course.
-Chris