How to Split OpenAI Text Output into Multiple Values Using Open and Closed Tags

Hi @Oliver_Marler,

Welcome to the Make community!

You can use a Text Parser “Match Pattern module with this regular expression pattern

\[SUMMARY\]\n*(?<summary>[\W\w]+?)\n*\[\/SUMMARY\]\n+\[MAIN_POINTS\]\n*(?<main_points>[\W\w]+?)\n*\[\/MAIN_POINTS\]\n+\[ACTION_ITEMS\]\n*(?<action_items>[\W\w]+?)\n*\[\/ACTION_ITEMS\]\n+\[FOLLOW_UP_QUESTIONS\]\n*(?<follow_up_questions>[\W\w]+?)\n*\[\/FOLLOW_UP_QUESTIONS\]\n+\[CLIENT_NAME\]\n*(?<client_name>[\W\w]+?)\n*\[\/CLIENT_NAME\]\n+\[FILE_NAME\]\n*(?<file_name>[\W\w]+?)\n*\[\/FILE_NAME\]\n+\[DOCUMENT_TYPE\]\n*(?<document_type>[\W\w]+?)\n*\[\/DOCUMENT_TYPE\]

Regex test: https://regex101.com/r/XzFvi6

Screenshot

Important Info

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

Output

This will split the GPT output into individual variables, in a SINGLE bundle, with a SINGLE operation

Aggregators not included.


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.

Hope this helps!

2 Likes