Hey @troy,
It looks to me like you did a workman like job in post #4 using Keyboard Maestro's available tools.
Most people don't know the Keyboard Maestro Engine adds a very powerful find/replace command to AppleScript.
It makes jobs like this pretty simple.
----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2018/08/18 23:01
# dMod: 2018/08/18 23:01
# Appl: Keyboard Maestro Engine
# Task: Search and Replace in AppleScript with Regular Expression Support Using Keyboard Maestro.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Keyboard_Maestro_Engine, @Search, @Replace, @Regular, @Expression, @Support
----------------------------------------------------------------
# Set the clipboard to demo text.
set the clipboard to "Now is the time for all good men to come to the aid of their country."
# Extract specific length strings from the clipboard.
set {dataStrFront, dataStrBack} to {text 1 thru 10, text 11 thru -1} of (get the clipboard)
# Search/Replace using the Keyboard Maestro Engine.
set newDataStr to kmReplace("\\b\\w", "•", dataStrFront, true, true, false) of me & dataStrBack
# Result:
--> "•ow •s •he time for all good men to come to the aid of their country."
----------------------------------------------------------------
--» HANDLERS
----------------------------------------------------------------
on kmReplace(findPattern, replacePattern, dataStr, regExBool, caseBool, tokensBool)
tell application "Keyboard Maestro Engine"
set foundDataList to search dataStr for findPattern replace replacePattern ¬
regex regExBool case sensitive caseBool process tokens tokensBool
end tell
end kmReplace
----------------------------------------------------------------
Now I'll break the script up, so it's a little easier to understand:
----------------------------------------------------------------
# Set the clipboard to demo text.
set the clipboard to "Now is the time for all good men to come to the aid of their country."
# Extract specific length strings from the clipboard.
set clipText to the clipboard
set dataStrFront to text 1 thru 10 of clipText
set dataStrBack to text 11 thru -1 of clipText
# Search/Replace using the Keyboard Maestro Engine.
set newDataStr to kmReplace("\\b\\w", "•", dataStrFront, true, true, false) of me
set newDataStr to newDataStr & dataStrBack
----------------------------------------------------------------
--» HANDLERS
----------------------------------------------------------------
on kmReplace(findPattern, replacePattern, dataStr, regExBool, caseBool, tokensBool)
tell application "Keyboard Maestro Engine"
set foundDataList to search dataStr for findPattern replace replacePattern ¬
regex regExBool case sensitive caseBool process tokens tokensBool
end tell
end kmReplace
----------------------------------------------------------------
Now I'll use find/replace for everything:
----------------------------------------------------------------
# Set the clipboard to demo text.
set the clipboard to "Now is the time for all good men to come to the aid of their country."
# Get the text from the clipboard.
set clipText to the clipboard
# Extract specific length strings from the clipboard.
set dataStrFront to kmReplace("^(.{10}).+", "$1", clipText, true, true, false) of me
set dataStrBack to kmReplace("^.{10}(.+)", "$1", clipText, true, true, false) of me
# Search/Replace using the Keyboard Maestro Engine.
set newDataStr to kmReplace("\\b\\w", "•", dataStrFront, true, true, false) of me
set newDataStr to newDataStr & dataStrBack
----------------------------------------------------------------
--» HANDLERS
----------------------------------------------------------------
on kmReplace(findPattern, replacePattern, dataStr, regExBool, caseBool, tokensBool)
tell application "Keyboard Maestro Engine"
set foundDataList to search dataStr for findPattern replace replacePattern ¬
regex regExBool case sensitive caseBool process tokens tokensBool
end tell
end kmReplace
----------------------------------------------------------------
NOTE - For those who don't know, AppleScripts are run using a Keyboard Maestro Execute an AppleScript action
-Chris