Export Based on Scope

Howdy y’all, I’m hoping someone can simply point me in the right direction or let me know if what I want to do is even possible:

Background: I work in customer service and take a lot of notes in Drafts. Some of these notes are for me only and some notes need to be copy/pasted to our app that stores customer interactions.

What I’ve done so far: I’ve created a syntax/theme that highlights my internal/personal notes and they are all within a scope that includes the word “admonition”.

What I’d like to do: write a script that exports based on the scope of the text so it only exports or copies to the clipboard anything not marked “admonition”. Or something similar. Any ideas? Thanks in advance, y’all.

When you say “scope”, do you mean a specific tag? Or is this just literally words in the text you are looking at?

Do you have a workspace for filtering just these to see only what you want?

Perhaps I’m using the wrong terminology (which is probably the case). In the syntax, I have the following:

"scope": "header.admonition.blue"

Would this be a tag, then?

Syntax definitions serve to highlight text in the editor. They don’t create any sort of structure to the underlying text…they don’t create any sort of attributes you can search or filter based on - only display styles.

Are you saying you have your personal notes intermingled with non-personal notes within the same draft, and are trying to separate those texts? Or are you saying you have some drafts that are personal and some that are not and you are trying to figure out which is which?

Either way, whatever regular expression logic you have in the Syntax that is used to identify the the scope and mark it could also be used to find those values in your text. It would not relying on the Syntax/Theme in anyway - just scan the text.

Correct, it’s all in a single draft. I essentially wrote a syntax and theme to emulate the Plain Notes package for Sublime Text but for Drafts. My personal notes that don’t end up going in the “final” notes that I copy/paste are in the colored blocks of text, or admonitions.

I wasn’t sure if there was some way to query the scopes/tags to remove what I didn’t want. But, I was already playing with the regex I’d created to go the route of searching the content of the draft, so that’s where I’ll head next! Thank you.