Split paragraph into list

Hello,
I really need your help. I have a paragraph that contains a list of items with their key and value.
Example:
Here is the list of items that we are looking for from XYZ:
Car Model: 123, Brand: YXZ, reference:908 I Car Model:567, Brand:KLH, reference:765, etc…

I would like to split each of them into a single row and under their respective column, and then push that information back in a db I created.

Thanks

Add a Text Parser module and configure it to parse the paragraph by splitting it into key-value pairs. You can use a regex like (Car Model:\s*\d+),\s*(Brand:\s*\w+),\s*(reference:\d+) for this.

Then, format the data into CSV. Add a Create CSV (advanced) module, define a data structure with columns for “Car Model”, “Brand”, and “Reference”, and map the parsed items to these columns.

After that, insert the data into your database. Add the appropriate database module (e.g., MySQL > Insert Row) and map the CSV data to your database fields.

You can also use the split function to extract key-value pairs from the paragraph. Add a an Iterator module and configure it to split the paragraph using delimiters. For instance, you can split the text using I as the delimiter to separate each item, and then further split each item using commas , to separate key-value pairs.

Welcome to the Make community!

Please provide the output bundles of the modules containing the example text 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”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.
Uploading them here will look like this:

module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

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.

This will allow others to better assist you. Thanks!

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!