I’m trying to format markdown in a long text field to something I can use in Zapier. The input looks something like this:
# This is a heading 1
This is a paragraph
- bulleted item 1
- bulleted item 2
- bulleted item 3
And here's a paragraph - with an embedded minus, and some more normal text
The output should look like this:
# This is a heading 1
This is a paragraph
- bulleted item 1
- bulleted item 2
- bulleted item 3
And here's a paragraph - with an embedded minus, and some more normal text
In essence, I need to replace the single newline after each paragraph with two newlines, except for the bulleted lists.
My first strategy is to use REGEX_REPLACE(source,“\n”,“\n\n”) which adds the 2 newlines everywhere. So far so good. But for the life of me I can’t find a way to remove the (now) extra newline between the bulleted items (lines starting with a “-”). It seems that the “^” (match at the beginning of a line) in Airtable’s REGEX doesn’t seem to work?
Any suggestions highly appreciated!