Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Help with Regex in Editorial
-
I normally don't ask the Internet to fix my stuff, but I am at a loss this time
This used to work in Editorial, but now it hasn't for a number of months.
I need to join a number of text lines into one. The number of lines various per document.
For example:
this is line one.
this is line two.becomes
this is line.this is line two.
As I said, this was working some months ago with a Regex workflow that I would edit for number of lines before running it. Now, nothing seems to work,
Here is my broken workflow: link text
Here is some example text: link text
Any assistance would be tremendously appreciated
Thank you -
Hi @scottcoulter ...nothing wrong with asking for some help. I have had a lot of help from those on the forum here!
If I understand correctly - you basically want to add the lines in your example like this:
highlight [page 4]: "The POV ascends quickly into the dark night sky, leaving young Rod far behind"
note [page 4]: Digital Matte Painting. ^2Becomes:
highlight [page 4]: "The POV ascends quickly into the dark night sky, leaving young Rod far behind" note [page 4]: Digital Matte Painting. ^2
So that 'note' line is appended to the 'highlight' line.
Can you try this out? Just make a workflow like this:
- Get text from document
- Run Python script
- Replace text in document
For the Python script try this:
#coding: utf-8 import workflow import re action_in = workflow.get_input() action_out = re.sub('\nnote', ' note', action_in) #this does a replace in regex - finding where there is a line break (\n) with note in the next line and replacing it with a space and 'note' workflow.set_output(action_out)
-
Well that worked!
I don't have the skills to mess around in Python, but holy moly, you have saved me dozens of hours of grinding work.
Thank you so much!
-
@scottcoulter okay cool. Glad to help.