Turn numbered list into elements

Hi - is it possible to turn a text numbered list:

  1. A
  2. B
  3. C

into a list of the elements eg [A, B, C]

Formula or action button all would work great. Additionally, can you separate the numbered list out from other text that precedes or succeeds it?

Thanks so much!!

1 Like

Hello @Alex_Popa1 ,

This is a bit tricky - a lot depends on the consistency of your list. Sticking to your example, for each line the separator for each element is the first space - the part preceding the first space needs to be deleted, the part behind the space is your element.
In order to use a formula, you need to be able to address the function to a textbox, column or something else.
When you start typing your list in this cell, Coda makes it into a numbered list, which is different from normal text. So in order for this to work, you have to copy and paste your numbered list into a ‘holding area’, I copy the numbered list to a column row (make sure you select a column row first, otherwise your list will end up one item per row. This column can be a canvas column or text column.
In your 2nd column you place your formula (calculate), in my sample below you see a screen print of this formula in the 3rd column.

Is this what you are looking for?

1 Like

I wanted to give this a go as well, seemed like a fun challenge :slight_smile:

I found that we can get rid of the list decorations simply by using ToText():

[Numbered List].ToText().Split(LineBreak())

Regarding extracting a numbered list from a text you could do something with this:

[Numbered List]._Merge().ToText()

(Prettyfied by Paul’s free pack)

But without a proper regex formula that supports groups I’m not to keen to try this myself :sweat_smile:

Thank you very much to both of you!! Combining your answers, I managed to find a general way to extract numbered lists into items. I think the snippet below is pretty agnostic to the text inside, other than the linebreaks! Thank you


1 Like