I’ve got a workable solution without a dependency, but I could use some guidance on one thing in specific. Why does #2 below not run?
1. This Works for the combination “ti”:
set findTI to "\\([a-zA-Z]\\)\\([0-9+%-]\\)\\([a-zA-Z]\\)"
set replaceTI to "\\1ti\\3"
set theWords to "Propriocep4ve, Posi+on, Contraindica%ons, a`achments, sta-cally, Lingual$nerve, ves6bule, supraglo.c, respiratory)center" --restric-ve"
set theshell to do shell script "echo " & quoted form of theWords & " | sed s/" & quoted form of findTI & "/" & quoted form of replaceTI & "/g"
2. This DOES NOT WORK for combinations “ti” and space:
set findTI to "\\([a-zA-Z]\\)\\([0-9+%-]\\)\\([a-zA-Z]\\)"
set replaceTI to "\\1ti\\3"
set findSpace to "\\([a-zA-Z]\\)\\([$)]\\)\\([a-zA-Z]\\)"
set replaceSpace to "\\1 \\3"
set theWords to "Propriocep4ve, Posi+on, Contraindica%ons, a`achments, sta-cally, Lingual$nerve, ves6bule, supraglo.c, respiratory)center" --restric-ve"
set theshell to do shell script "echo " & quoted form of theWords & " | sed s/" & quoted form of findTI & "/" & quoted form of replaceTI & "/g" & ";s/" & quoted form of findSpace & "/" & quoted form of replaceSpace & "/g"
3. This works for “4”, “ti”, “+”, “.”, “`”, “-”, “%”, space:
set theWords to "Propriocep4ve, Posi+on, Contraindica%ons, a`achments, sta-cally, Lingual$nerve, ves6bule, supraglo.c, respiratory)center" --restric-ve"
set theshell to do shell script "echo " & quoted form of theWords & " | sed 's/\\([a-zA-Z]\\)\\([0-9+%-]\\)\\([a-zA-Z]\\)/\\1ti\\3/g;s/\\([a-zA-Z]\\)\\([$)]\\)\\([a-zA-Z]\\)/\\1 \\3/g;s/\\([a-zA-Z]\\)\\([.`]\\)\\([a-zA-Z]\\)/\\1tt\\3/g'"