Regular expression to return multiple lines of text after search term until blank line

I am the first to admit that I don’t understand regular expressions. I’ve tried and tried but it just doesn’t click so I could use some help creating one to do something slightly complex (at least for me). I have an Apple Note that has twelve sections or groups with one or more lines after it that are separated by a blank line. So it basically looks like this:

Week 1: School Group 1 — text here

  1. list item 1
  2. list item 2

Week 2: School Group 2 — description here

  1. another list item 1
  2. another list item 2
  3. another list item 3

Week 3: Work Group 1 — work text

  1. work item A
  2. work item B

etc.

I have a Shortcut that gets the note and searches for the title/header of each section (i.e. Week X: Group Y…) and then passes those to a Choose from List so I can select which group of information I’m going to work with. What I need is another Match Text action with a regular expression that will return everything after my search term until the next blank line.

For example, if I select “Week 1: Group 1 — text here” then it would return:

  1. list item 1
  2. list item 2

And if I select “Week 2: Group 2 — description here” then it would return:

  1. another list item 1
  2. another list item 2
  3. another list item 3

Can anyone please help with this? It would be very much appreciated. Thank you in advance.

Try this.

https://www.icloud.com/shortcuts/b32a5ac1159f4d5e835c3f99f54b5f1c

I used the following note based on your example, but with a unique title as you didn’t provide any informatin about how you get the specific note you want to process.

It will prompt you to select the heading.

Then it just returns the result in the example shortcut.

E.g.

It will work for sections followed by a section as well as sections not followed by a section, and is based on sections all beginning with the word “week” and your non-section lines not beginning with the word “week” If they ever will, then some revision to the note format I think might be required as currently, it is only getting raw text from the note, so any formatting you may have is unavailable.

Hope that helps.

You nailed it. Thank you! I would never have thought to section it off with the Split Text action but it works. I’ll try to figure out how to handle the custom formatting. The next step will be to create either a text or email with those contents so I can probably renumber the items when I create that.

Thank you again. Very much appreciated.