How to do a double split text?

Hi,

I have text with three sections (coming from a chat model). Start, Stop and Continue.
How to split these in three separate variables so I can put them in different cells in Google Sheets.

Is it possible to a double split? With Stop and Continue?
The first part split works and I can also can make the last part work, but how to get the middle section, that’s for my the tricky part.

Hereby an output

[
    {
        "textResponse": "Start:\n1. Visual Enhancement:\n   - Incorporate more dynamic b-roll footage to showcase the product in use\n   - Use close-up shots to highlight product details\n   - Display ingredient measurements on-screen\n\n2. Content Improvement:\n   - Add clickable timestamps in the video description for easy navigation\n   - Implement a clear call-to-action (CTA) at the end of the video\n   - Include a brief comparison with similar products in the market\n   - Showcase common substitutions for dietary restrictions\n\n3. Accessibility:\n   - Add English subtitles\n   - Include a printable recipe card in the video description\n\nStop:\n1. Audio Issues:\n   - Using generic stock music that doesn't match the brand's vibe\n   - Using background music that overpowers the narrator's voice\n\n2. Content Problems:\n   - Overloading the video with too many sponsorship mentions\n   - Rushing through important product features or complex cooking techniques\n   - Spending too much time on the unboxing process\n   - Using technical jargon without explanation\n   - Assuming viewers have advanced cooking knowledge\n\n3. Visual Distractions:\n   - Filming in a cluttered background that distracts from the product\n\nContinue:\n1. Production Quality:\n   - Maintaining high-quality video production and crisp audio\n   - Maintaining high-quality food videography\n\n2. Presentation:\n   - Engaging with viewers through witty and relatable commentary\n   - Maintaining enthusiasm and energy throughout the video\n   - Injecting humor and personality into the narration\n\n3. Content Delivery:\n   - Collaborating with the influencer who has great on-screen presence\n   - Demonstrating key features with hands-on examples\n   - Providing useful cooking tips and tricks throughout the video\n\n4. Audience Engagement:\n   - Responding to viewer comments for increased engagement\n",
        "id": "msg_012Cb9zkyHkKVvCEehCxn8zD",
        "type": "message",
        "role": "assistant",
        "model": "claude-3-5-sonnet-20240620",
        "content": [
            {
                "type": "text",
                "text": "Start:\n1. Visual Enhancement:\n   - Incorporate more dynamic b-roll footage to showcase the product in use\n   - Use close-up shots to highlight product details\n   - Display ingredient measurements on-screen\n\n2. Content Improvement:\n   - Add clickable timestamps in the video description for easy navigation\n   - Implement a clear call-to-action (CTA) at the end of the video\n   - Include a brief comparison with similar products in the market\n   - Showcase common substitutions for dietary restrictions\n\n3. Accessibility:\n   - Add English subtitles\n   - Include a printable recipe card in the video description\n\nStop:\n1. Audio Issues:\n   - Using generic stock music that doesn't match the brand's vibe\n   - Using background music that overpowers the narrator's voice\n\n2. Content Problems:\n   - Overloading the video with too many sponsorship mentions\n   - Rushing through important product features or complex cooking techniques\n   - Spending too much time on the unboxing process\n   - Using technical jargon without explanation\n   - Assuming viewers have advanced cooking knowledge\n\n3. Visual Distractions:\n   - Filming in a cluttered background that distracts from the product\n\nContinue:\n1. Production Quality:\n   - Maintaining high-quality video production and crisp audio\n   - Maintaining high-quality food videography\n\n2. Presentation:\n   - Engaging with viewers through witty and relatable commentary\n   - Maintaining enthusiasm and energy throughout the video\n   - Injecting humor and personality into the narration\n\n3. Content Delivery:\n   - Collaborating with the influencer who has great on-screen presence\n   - Demonstrating key features with hands-on examples\n   - Providing useful cooking tips and tricks throughout the video\n\n4. Audience Engagement:\n   - Responding to viewer comments for increased engagement"
            }
        ],
        "stop_reason": "end_turn",
        "stop_sequence": null,
        "usage": {
            "input_tokens": 406,
            "output_tokens": 422
        }
    }
]

Honestly easiest way is to go and input this as constraints right into the model itself this is what I would say.

"Please provide the feedback in a JSON format with three keys: ‘Start,’ ‘Stop,’ and ‘Continue.’ Each key should contain the corresponding feedback text. Here is the format:

{
  "Start": "Your Start feedback here...",
  "Stop": "Your Stop feedback here...",
  "Continue": "Your Continue feedback here..."
}

Please follow this structure strictly."

1 Like

Welcome to the Make community!

You can use a Text Parser “Match Pattern” module with this Pattern (regular expression):

Start:\s+(?<start>[\w\W]+?)\s+Stop:\s+(?<stop>[\w\W]+?)\s+Continue:\s+(?<continue>[\w\W]+?)\s+$

Proof https://regex101.com/r/6t4ENA/1

Important Info

  • :warning: Global match must be set to NO!

Screenshot

Output


For more information, see Text Parser in the Make Help Center:

Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

Click to Expand Module Export Code

JSON - Copy and Paste this directly in the scenario editor

{"subflows":[{"flow":[{"id":116,"module":"regexp:Parser","version":1,"parameters":{"pattern":"Start:\\s+(?<start>[\\w\\W]+?)\\s+Stop:\\s+(?<stop>[\\w\\W]+?)\\s+Continue:\\s+(?<continue>[\\w\\W]+?)\\s+$","global":false,"sensitive":true,"multiline":false,"singleline":false,"continueWhenNoRes":false},"mapper":{"text":"{{115.textResponse}}"},"metadata":{"designer":{"x":1381,"y":19},"parameters":[{"name":"pattern","type":"text","label":"Pattern","required":true},{"name":"global","type":"boolean","label":"Global match","required":true},{"name":"sensitive","type":"boolean","label":"Case sensitive","required":true},{"name":"multiline","type":"boolean","label":"Multiline","required":true},{"name":"singleline","type":"boolean","label":"Singleline","required":true},{"name":"continueWhenNoRes","type":"boolean","label":"Continue the execution of the route even if the module finds no matches","required":true}]}}]}],"metadata":{"version":1}}

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

1 Like

Hi,

Thanks for the responses!

@samliew I used your example but I do not get any output. Any clue why?

Input

[
    {
        "text": "Start:\n1. Visual Enhancement:\n   - Incorporate more dynamic b-roll footage to showcase the product in use\n   - Use close-up shots to highlight product details\n   - Display ingredient measurements on-screen\n\n2. Content Improvement:\n   - Add clickable timestamps in the video description for easy navigation\n   - Implement a clear call-to-action (CTA) at the end of the video\n   - Include a brief comparison with similar products in the market\n   - Showcase common substitutions for dietary restrictions\n\n3. Accessibility:\n   - Add English subtitles\n   - Include a printable recipe card in the video description\n\nStop:\n1. Audio Issues:\n   - Using generic stock music that doesn't match the brand's vibe\n   - Using background music that overpowers the narrator's voice\n\n2. Content Problems:\n   - Overloading the video with too many sponsorship mentions\n   - Rushing through important product features or complex cooking techniques\n   - Spending too much time on the unboxing process\n   - Using technical jargon without explanation\n   - Assuming viewers have advanced cooking knowledge\n\n3. Visual Distractions:\n   - Filming in a cluttered background that distracts from the product\n\nContinue:\n1. Production Quality:\n   - Maintaining high-quality video production and crisp audio\n   - Maintaining high-quality food videography\n\n2. Presentation:\n   - Engaging with viewers through witty and relatable commentary\n   - Maintaining enthusiasm and energy throughout the video\n   - Injecting humor and personality into the narration\n\n3. Content Delivery:\n   - Collaborating with the influencer who has great on-screen presence\n   - Demonstrating key features with hands-on examples\n   - Providing useful cooking tips and tricks throughout the video\n\n4. Audience Engagement:\n   - Responding to viewer comments for increased engagemen"
    }
]

Did you import the module I provided above?

If you need further assistance, please provide the following:

1. Relevant Screenshots

Please share screenshots of your scenario, any error messages, relevant module fields, and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:

2. Scenario Blueprint

Please export the scenario blueprint file to allow others to view the mapped variables in the module fields. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

3. Output Bundles of Modules

Please provide the output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.

A. Upload as Text File

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

@samliew Yes, I imported it module.

I created a new scenario just with the module to test it out again. No output (unless you have to create a module afterwards to get the output?)

Hereby the scenerio:
blueprint.json (5.8 KB)

Also a screenshot

Hmm, looks like the Match pattern module might have a bug.

Anyway, we can also use this alternate pattern:

Start:\s+(?<start>[\w\W]+?)\s+Stop:\s+(?<stop>[\w\W]+?)\s+Continue:\s+(?<continue>[\w\W]+)

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

Click to Expand Module Export Code

JSON - Copy and Paste this directly in the scenario editor

{"subflows":[{"flow":[{"id":1,"module":"regexp:Parser","version":1,"parameters":{"pattern":"Start:\\s+(?<start>[\\w\\W]+?)\\s+Stop:\\s+(?<stop>[\\w\\W]+?)\\s+Continue:\\s+(?<continue>[\\w\\W]+)","global":false,"sensitive":true,"multiline":false,"singleline":false,"continueWhenNoRes":false},"mapper":{"text":"Start:\n1. Visual Enhancement:\n   - Incorporate more dynamic b-roll footage to showcase the product in use\n   - Use close-up shots to highlight product details\n   - Display ingredient measurements on-screen\n\n2. Content Improvement:\n   - Add clickable timestamps in the video description for easy navigation\n   - Implement a clear call-to-action (CTA) at the end of the video\n   - Include a brief comparison with similar products in the market\n   - Showcase common substitutions for dietary restrictions\n\n3. Accessibility:\n   - Add English subtitles\n   - Include a printable recipe card in the video description\n\nStop:\n1. Audio Issues:\n   - Using generic stock music that doesn't match the brand's vibe\n   - Using background music that overpowers the narrator's voice\n\n2. Content Problems:\n   - Overloading the video with too many sponsorship mentions\n   - Rushing through important product features or complex cooking techniques\n   - Spending too much time on the unboxing process\n   - Using technical jargon without explanation\n   - Assuming viewers have advanced cooking knowledge\n\n3. Visual Distractions:\n   - Filming in a cluttered background that distracts from the product\n\nContinue:\n1. Production Quality:\n   - Maintaining high-quality video production and crisp audio\n   - Maintaining high-quality food videography\n\n2. Presentation:\n   - Engaging with viewers through witty and relatable commentary\n   - Maintaining enthusiasm and energy throughout the video\n   - Injecting humor and personality into the narration\n\n3. Content Delivery:\n   - Collaborating with the influencer who has great on-screen presence\n   - Demonstrating key features with hands-on examples\n   - Providing useful cooking tips and tricks throughout the video\n\n4. Audience Engagement:\n   - Responding to viewer comments for increased engagement\n\n​"},"metadata":{"designer":{"x":266,"y":6},"parameters":[{"name":"pattern","type":"text","label":"Pattern","required":true},{"name":"global","type":"boolean","label":"Global match","required":true},{"name":"sensitive","type":"boolean","label":"Case sensitive","required":true},{"name":"multiline","type":"boolean","label":"Multiline","required":true},{"name":"singleline","type":"boolean","label":"Singleline","required":true},{"name":"continueWhenNoRes","type":"boolean","label":"Continue the execution of the route even if the module finds no matches","required":true}]}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

2 Likes

Hi @Tommyst
Please enable global match and multiline in the setting as follows:


Output:

Best regards,

Msquare Automation
Gold Partner of Make
@Msquare_Automation

@samliew This one works wonderful, thank you!

2 Likes

No problem, glad I could help!

1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!