> On Sep 26, 2022, at 08:22, Lionel <[email protected]> wrote:
> 
> AppleScript is not really a friend of regex ;-) You have to test the text to 
> transform with BBEdit and then translate it into AppleScript string to 
> incorporate it into the script. 
> 
> And sometimes it doesn't work, for example with \x20{6} supposed to replace 
> six spaces. Is there a way to enter in AppleScript the same plain text used 
> in BBEdit, with a tell statement for exemple ?


Hey Lionel,

I suppose you could look at it that way.  I know I cussed and carried on about 
having to manage quoting strings in AppleScript strings for a while. I even had 
a routine that did all the work on the clipboard with a regex osax way back in 
the day.

Then I bought Script Debugger <https://latenightsw.com/> which has a built-in 
command for pasting-quoted, and I never looked back.

Keep in mind that the back-slash is a reserved character in AppleScript and as 
such must be escaped to be used as a literal.


tell application "BBEdit"
    tell front text window's text
        replace "\\x20{6}" using "••••••" options {search mode:grep, case 
sensitive:false, starting at top:true}
    end tell
end tell


--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/59D2F19E-F530-41E3-ADC5-01A8AD637655%40gmail.com.

Reply via email to