1

the text I work with has marked each words or sentences that should be a marginalia with ##before and after##

as in:

Edi nos di occus aceaqui blam rerorent eumetur aut eaquid qui ut velibus quid elecab iust, sinit, voluptatur sam ut eum ##I'm a maginalia## dolupta volupti orepudita deruntiur? Dus, sequam, se doluptatem quis antotatquid que excepudi ##and I'm a pretty marginalia## comnis et res nestrum ex ent.

I'm using a tiny script that moves them to their designated places when selected. (So I have to select every single supposed marginalia separately to use the script on each selection.)

My problem is: If there is only one marginalia in a paragraph ##.+## works just fine but if there are two ore more occurences, this selects all text inbetween the first and the last ## in the paragraph.

as in:

Edi nos di occus aceaqui blam rerorent eumetur aut eaquid qui ut velibus quid elecab iust, sinit, voluptatur sam ut eum ##I'm a maginalia## dolupta volupti orepudita deruntiur? Dus, sequam, se doluptatem quis antotatquid que excepudi ##and I'm a pretty marginalia## comnis et res nestrum ex ent.

Is there a way with GREP to find the next occurence of ## after any other text inbetweenthe first ##?

2
  • Wouldn’t it make it easier for you if the script did the GREP search as well as the moving, so you didn’t have to go through manually selecting each marginale and running the script? That way you’d just run the script once and it moves all marginalia to their proper place, and the whole thing can be undone in a single Undo stroke. – Janus Bahs Jacquet Apr 28 at 10:02
  • Yes, well, that would be nice. I recently took a script seminar so maybe I can manage to change the script a bit. A simple GREP-Search and loop sounds manageable for a beginner :) Thanks for the idea. – SabineR Apr 29 at 14:05
2

Never mind. ##.+?## is the answer. Sometimes after ages of struggle you simply have to ask the question to suddenly find the answer yourself.

+? keeps the search to the first complete sequence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.