AppleScriptのreplaceで置換文字列に$1とか書くのは未実装です?
tell application "CotEditor" to if exists front document then tell front document to replace for "a" to "$0" with RE
ってコードで、aという文字列を$0という文字列に置換してしまう
(期待する動作は、aを$0の参照するaに置換する(つまり文字列は結果として変化しない))
バージョンは3.1.2 (177)