A Regex Pattern for Editorial to Select a Single TaskPaper Project

Recorded on February 15th, 2016

I had a breakthrough today! I was stepping through some old TaskPaper-formatted projects in Editorial and wanted a quick way to grab a project and shoot it to a someday/maybe/later file so it wouldn’t clutter up my main Current.taskpaper file. I figured the best way would be to tap the folding triangle icon to fold the project, select it, cut it, and paste it to Backlog.taskpaper. But I didn’t want to leave the Bluetooth keyboard to do it, and I didn’t see an existing workflow to fold a single TaskPaper project.

I always separate TaskPaper projects with a blank line, just so they have some breathing space. I realized that if I put the cursor in the current project header line and made a workflow to select that whole line, and then do a regex to find and extend the selection to also grab all the tasks + notes underneath the project, then I could cut and paste that into another file. I haven’t finished that whole workflow, but I did finally figure out the regex pattern. It’s this:


The key to this was an answer on Stack Overflow, where someone was looking for something similar. The \n{2} is the trick that searches for two newlines in a row, which will find the blank line underneath my project. Everything else in the pattern just selects all the lines in the current project until that point.

Playing with this would have been impossible if it weren’t for the eternally useful RegEx101, where you can plug in a regex and test it against your own text until you get the match you need.

screenshot of RegEx101

Here’s what the finished regex looks like in the Find action.

screenshot of Find action

And here’s Editorial’s automatic selection of just the current project.

screenshot of selected project in Editorial

I’ll share the whole workflow once I finish it and get it working totally right.

blog comments powered by Disqus