Macro with regex to delete all paragraphs starting with > for use in Bear Notes

Hello,
For use in Bear Notes (common markdown format), I would like to create a macro to

  • delete all paragraphs (everything before line feed)
  • that start with the character >
  • in the clipboard

thank you very much

image

While writing a regex based on that description is feasible, it would be helpful if you could post a sample of a block of text that you'd have on the clipboard.

-rob.

1 Like

You are very diplomatic because I should have thought of that and you must be shaking your head. Sorry

Here is the text in the Bear Note (common markdown format)

Here is what it looks like if I copy from Bear and paste into BBEdit.

thanks very much

Thanks, that helps ... sorta, as I'm now confused. You asked:

"delete all paragraphs (everything before line feed) that start with the character >"

In your example, wouldn't that delete everything? Every paragraph starts with a ">" character.

-rob.

1 Like

yes, I would delete everything. I could have added a line not starting with >, for example

Click the message icon at the bottom of any support page to email us. Please include details like your device and anything else about your question or problem that can help.
this should not be deleted
Select the notes your want or all the notes (⌘A in the note list), go to File > Export Notes, select markdown, and check "export
attachments" and "merge notes in a single file", finally hit save.
This is a test and should not be deleted
This will create a file named as the first note of the list and a folder containing all the attachments. You can delete the file and keep the folder.

thanks again

You should be able to use this:

Here's the text in the search:

(?m)>.*$

The (?m) means "multi line," so this will search each line for the conditions. Than the greater than sign, and .*$ means "any characters until the end of the line."

In my testing, this left the lines without leading greater than signs on the clipboard.

-rob.

2 Likes

thank you very much @griffman
Unfortunately, there is a problem
Instead of deleting, I end up as per arrow (same as if pasted to BBEdit) : one * on each side which converts text to italics.

2024-03-20_08-07-16
2024-03-20_08-07-26

You have the Search action set to String mode, not Regular Expression:

image
image

-rob.

1 Like

I am terribly sorry. Thank you very much !

1 Like