On 04/02/2018, at 21:39, Jean-Christophe Helary 
<[email protected] <mailto:[email protected]>> 
wrote:
> I'm not sure I understand why the following grep search doesn't work:


Hey Jean-Christophe,

Because you're referencing the wrong object – the window and not the window's 
text.


tell application "BBEdit"
    tell front text window's text
        replace "(?m)(.{50})" using "\\1••••" options {search mode:grep, case 
sensitive:false, starting at top:true}
    end tell
end tell


BBEdit is very recordable, so when you get stuck like this hit the record 
button in the Script Editor (or Script Debugger), switch back to BBEdit and do 
your task.

BBEdit is very literal in how it records things, so very often some clean-up is 
required.

BUT – more often than not you can find out the correct syntax for things this 
way.

Here's an example of a recording:

tell application "BBEdit"
    activate
    replace "(?m)(.{50})" using "\\1••••" searching in text 1 of text document 
1 options {search mode:grep, starting at top:true}
end tell


--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to