Split API response into separate RGs based on response tags

I’m having trouble trying to create the correct expressions to split up my API call responses.

  • I want to separate the API response below by tagged Type: -Improvements or Additions, each into its own RG (Improvements and Additions).
  • Then in each, a nested group to capture everything below besides line 1 and 2.
  • Then in another nested text group I only want to capture the below parts:

Title
Description:

ie: Define UI design milestones

Description: Establish clear milestones within the UI design process, including initial drafts, feedback rounds, and final approval.

Here is the API response:

[b]Design website UI[/b]
_The task lacks a clear timeline and specific milestones, which could lead to delays and inefficiencies in the design process. Additionally, there's no mention of collaboration with other departments such as Marketing or Content, which is crucial for ensuring the UI aligns with the overall brand and content strategy._

[b]Define UI design milestones[/b]

[b]Description:[/b] Establish clear milestones within the UI design process, including initial drafts, feedback rounds, and final approval.
_[b]Assignee:[/b] Brendan Ford
[b]Due Date:[/b] 15 April 2024
[b]Priority:[/b] High
~[b]Task ID:[/b] ~1705356741117x264525669552619520~
Type: -Addition

[b]Facilitate cross-departmental collaboration[/b]

[b]Description:[/b] Schedule regular meetings between the UI design team and Marketing and Content departments to ensure alignment on brand and content strategy.
_[b]Assignee:[/b] Brendan Ford
[b]Due Date:[/b] 20 April 2024
[b]Priority:[/b] Medium
~[b]Task ID:[/b] ~1705339060350x903892167533527000~
Type: -Addition

[b]Create new item[/b]

[b]Description:[/b] Create an new item to fix this.
_[b]Assignee:[/b] Brendan Ford
[b]Due Date:[/b] 20 April 2024
[b]Priority:[/b] Medium
~[b]Task ID:[/b] ~1705339060350x903892167530~
Type: -Improvement

Can anyone help please!

If you want to grab exact line numbers, you can take the entire response and do :split by ( press enter for a newline ):item #[line number]

Then do it a bunch of times for each line number you want
image

You just have to pray none of those lines have a line break in them :rofl:

Thanks for the reply @tylerboodman. I don’t think my explanation was very good so I’ve clarified my original post again. Any ideas? :crossed_fingers:

Ok. It was not easy but I could do it :slight_smile:

Here is the final result. Every field is reachable and additions/improvements can be grouped:

And below is step by step what I did.

  • Removing the top three lines. This one is easy, just split by new line and get the items starting from 4:
    image

  • Then, I removed the double new lines to have only 1-liners (just split by and join OR find and replace):

  • Then, I added separators between different groups to easily split them later on. I did by replacing Task: -Improvement with Task: -Improvement<newline>--- and the same for Task Addition.

  • Now, I have these 3 items easily separated by ---:

  • I can put them into different repeating groups by just checking if they contain Type: -Improvement or the other:

  • Finally, I can extract values with regex. I found this to be helpful: Regex get string between string and newline - Stack Overflow After extraction, you can put them wherever you want:

Of course, on the way, I had to remove because regex was complaining about those. Here is the regex to extract Priority field for example: (?<=Priority: )(.*?)(?=[\n])

And here is the editor if anyone wants to check these steps: Tests for Forum 10 | Bubble Editor

As @tylerboodman noted, if any of these lines are coming with a new line, you should be careful about this solution.

This topic was automatically closed after 70 days. New replies are no longer allowed.