# Incorrectly truncated text parsing

**URL:** <https://community.make.com/t/incorrectly-truncated-text-parsing/50016>\
**Category:** Questions\
**Tags:** text-parser\
**Created:** [August 8, 2024, 3:06am UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016 "2024-08-08T03:06:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jamiak](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@Jamiak](https://community.make.com/u/Jamiak)\
**Post date:** [August 8, 2024, 3:06am UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016/1 "2024-08-08T03:06:30Z")

</div>

Hi,

I’m having trouble parsing match pattern text to map to Airtable fields and ultimately to WordPress. This is my first time using a text parser, so I’m not sure if this is correct or not, but when I identify the pattern, it either parses incorrectly, truncates it, or doesn’t parse anything at all.

Here is the search pattern expression I’m using:

 ![Screen Shot 2024-08-07 at 10.57.42 PM](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/0/a/0aa60bcf3f6e6f567331f2c9271f060ab434c1c7.jpeg)

Here is the text I need to parse:

 ![Screen Shot 2024-08-07 at 11.03.46 PM](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/6/d/6db3fbe29248763a0885d8f108cabd052e9de4cf.png)

And here’s the blueprint:  
[blueprint (1).json](https://community.make.com/uploads/short-url/ebu96AXdEnMs0ifG7XPUlqHxJWj.json) (135.8 KB)

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [August 8, 2024, 3:15am UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016/2 "2024-08-08T03:15:37Z")

</div>

Welcome to the Make community!

When reaching out for assistance with your regex pattern for a Text Parser module, it would be super helpful if you could share the actual text you’re trying to match. Screenshots of text can be a bit tricky, so if you could **copy and paste the text directly here** , that would be awesome! It ensures we can run it against test patterns effectively. If there’s any sensitive info, feel free to change it to something fictional yet still valid by **keeping the format intact**.

Providing clear text examples saves time on both ends and helps us give you the best possible solution. Without proper examples, we might end up playing a guessing game, and nobody wants that as it is a waste of time! You are more likely to get a correct answer faster. So, help us help you by sharing those text snippets.

Please format the example text this way to preserve line breaks and special characters:

These are the two ways to format text so that it won’t be modified by the forum:

- **Method 1: Type code block manually**

- **Method 2. Highlight and click the format button in the editor**

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

— @samliew

---

<div class="post-metadata">

**Author:** ![Jamiak](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@Jamiak](https://community.make.com/u/Jamiak)\
**Post date:** [August 8, 2024, 11:13pm UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016/3 "2024-08-08T23:13:05Z")

</div>

Okay, here’s the correctly formatted text output from Claude:

```auto

[SLUG]ghana-cocoa-supply-shortfall-impacts-traders[/SLUG]

[TITLE]Sweet Trouble: Ghana's Cocoa Shortfall Leaves Traders in a Bitter Spot[/TITLE]

[EXCERPT]Ghana's cocoa bean delivery hiccup has traders facing a whopping $1 billion loss. Here's what happened and why it matters for your morning mocha.[/EXCERPT]

[BODY]
<p>Hey there, chocolate lovers and market watchers! Grab your favorite cocoa-based snack because we've got some news that might make your wallet feel a little lighter (but hopefully not your candy bar).</p>

<h2>The Scoop on the Cocoa Chaos</h2>

<p>Reuters just dropped an exclusive report that's shaking up the cocoa world. Here's what you need to know:</p>

<ul>
<li>🍫 Trading houses are staring down the barrel of a $1 billion loss. Ouch!</li>
<li>🇬🇭 Ghana, a major cocoa producer, couldn't deliver the beans this year. Talk about a supply chain hiccup!</li>
<li>📉 Traders had to scramble to cover their positions in a market that's been heading up, up, up.</li>
</ul>

<h2>Why This Matters</h2>

<p>You might be thinking, "So what? I'm not a cocoa trader." But hold on to your chocolate bars, because this could affect more than just the folks in fancy suits:</p>

<ul>
<li>🍪 Your favorite treats might get pricier. When cocoa costs more, so does everything made with it.</li>
<li>💼 It's a wake-up call for how vulnerable global supply chains can be.</li>
<li>🌍 This could impact Ghana's economy and potentially other cocoa-producing nations.</li>
</ul>

<h2>Market Impact: More Than Just a Hill of Beans</h2>

<p>Let's break down what this cocoa conundrum could mean for the markets:</p>

<ul>
<li>📈 Cocoa futures are likely to stay volatile. Keep an eye on the iPath Bloomberg Cocoa Subindex Total Return ETN (NIB) if you're into that sort of thing.</li>
<li>🍫 Big chocolate producers like Hershey (HSY) and Mondelez (MDLZ) might see their costs go up, which could squeeze their profits.</li>
<li>🚜 Agricultural commodity traders like Archer-Daniels-Midland (ADM) could face some headwinds.</li>
<li>🌱 This might boost interest in alternative sweeteners and plant-based chocolate substitutes. Companies in this space could see increased attention.</li>
</ul>

<p>So there you have it, folks. A billion-dollar bean blunder that's got traders sweating and could have us all digging a little deeper for our chocolate fix. Keep your eyes peeled for how this plays out – it's sure to be a wild ride in the world of cocoa!</p>
[/BODY]

[CATEGORIES]Finance,Commodities,Global Trade[/CATEGORIES]

[TAGS]cocoa,Ghana,commodities,trading,supplychain,chocolate

```

And here’s an example of the one of the regex patter texts:

`[SLUG]([\s\S]*?)[/SLUG]`

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [August 9, 2024, 12:49am UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016/4 "2024-08-09T00:49:25Z")

</div>

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of two modules, a Text Parser and an Array Aggregator.

 ![](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/3/a/3a0c58927f26b0aa42ae058e92d98af878686a3a.png)

You can use a Text Parser “[Match Pattern](https://www.make.com/en/help/tools/text-parser)” module with this Pattern (regular expression), to match all the content in the tags.

```plaintext
\[(?<tag>[^\]]+)]\s*(?<content>[\w\W]+?)\s*\[\/\1]

```

**Proof** [https://regex101.com/r/T5S2B8/1](https://regex101.com/r/T5S2B8/1)

One module matches all tags.

 ![Screenshot_2024-08-09_080818](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/f/d/fd767122f3a524abc2d32643534c5da3c0221a65.png)

### Important Info

- ⚠ **Global match** must be set to **YES**!

## Screenshot

 ![Screenshot_2024-08-09_080849](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/9/e/9eaed8fd0fe50107b27192cb61ee1e012554f386.png)

## Output

 ![Screenshot_2024-08-09_080801](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/6/c/6c221079a726db9912267a3ac15d89b71ab6bf4a.png)

* * *

For more information, see [Text Parser](https://www.make.com/en/help/tools/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](https://en.wikipedia.org/wiki/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.
> 
> - The complete list of metacharacters can be found on the [MDN web docs website](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).
> - For a tutorial on how to create regular expressions, we recommend the [RegexOne website](https://regexone.com/).
> - For an easy, quick regex generator, try the [Regular Expressions generator](https://regex-generator.olafneumann.org/).
> - For experimenting with regular expressions, we recommend the [regular expressions 101 website](https://regex101.com/). Just make sure to tick the ECMAScript (JavaScript) FLAVOR in the left panel.

* * *

Then, use an Array Aggregator to combine all the matches into a single bundle.

 ![Screenshot_2024-08-09_080849 (2)](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/d/6/d6087aa1fb1011cc1a90d4bb8839f1084228794a.png)

## Output

 ![Screenshot_2024-08-09_080840](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/f/d/fdeb6ed2c359da8d04e31f4b58423d3cb24ca96b.png)

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

— @samliew

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [August 9, 2024, 12:50am UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016/5 "2024-08-09T00:50:29Z")

</div>

## 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  
 ![](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/2/b/2b1b692880388420db5045bf51ef344e6698a816.png)

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
> 
> ```json
> {
> "subflows": [
> {
> "flow": [
> {
> "id": 206,
> "module": "util:ComposeTransformer",
> "version": 1,
> "parameters": {},
> "mapper": {
> "value": "[SLUG]ghana-cocoa-supply-shortfall-impacts-traders[/SLUG]\n\n[TITLE]Sweet Trouble: Ghana's Cocoa Shortfall Leaves Traders in a Bitter Spot[/TITLE]\n\n[EXCERPT]Ghana's cocoa bean delivery hiccup has traders facing a whopping $1 billion loss. Here's what happened and why it matters for your morning mocha.[/EXCERPT]\n\n[BODY]\n<p>Hey there, chocolate lovers and market watchers! Grab your favorite cocoa-based snack because we've got some news that might make your wallet feel a little lighter (but hopefully not your candy bar).</p>\n\n<h2>The Scoop on the Cocoa Chaos</h2>\n\n<p>Reuters just dropped an exclusive report that's shaking up the cocoa world. Here's what you need to know:</p>\n\n<ul>\n<li>🍫 Trading houses are staring down the barrel of a $1 billion loss. Ouch!</li>\n<li>🇬🇭 Ghana, a major cocoa producer, couldn't deliver the beans this year. Talk about a supply chain hiccup!</li>\n<li>📉 Traders had to scramble to cover their positions in a market that's been heading up, up, up.</li>\n</ul>\n\n<h2>Why This Matters</h2>\n\n<p>You might be thinking, \"So what? I'm not a cocoa trader.\" But hold on to your chocolate bars, because this could affect more than just the folks in fancy suits:</p>\n\n<ul>\n<li>🍪 Your favorite treats might get pricier. When cocoa costs more, so does everything made with it.</li>\n<li>💼 It's a wake-up call for how vulnerable global supply chains can be.</li>\n<li>🌍 This could impact Ghana's economy and potentially other cocoa-producing nations.</li>\n</ul>\n\n<h2>Market Impact: More Than Just a Hill of Beans</h2>\n\n<p>Let's break down what this cocoa conundrum could mean for the markets:</p>\n\n<ul>\n<li>📈 Cocoa futures are likely to stay volatile. Keep an eye on the iPath Bloomberg Cocoa Subindex Total Return ETN (NIB) if you're into that sort of thing.</li>\n<li>🍫 Big chocolate producers like Hershey (HSY) and Mondelez (MDLZ) might see their costs go up, which could squeeze their profits.</li>\n<li>🚜 Agricultural commodity traders like Archer-Daniels-Midland (ADM) could face some headwinds.</li>\n<li>🌱 This might boost interest in alternative sweeteners and plant-based chocolate substitutes. Companies in this space could see increased attention.</li>\n</ul>\n\n<p>So there you have it, folks. A billion-dollar bean blunder that's got traders sweating and could have us all digging a little deeper for our chocolate fix. Keep your eyes peeled for how this plays out – it's sure to be a wild ride in the world of cocoa!</p>\n[/BODY]\n\n[CATEGORIES]Finance,Commodities,Global Trade[/CATEGORIES]\n\n[TAGS]cocoa,Ghana,commodities,trading,supplychain,chocolate[/TAGS]"
> },
> "metadata": {
> "designer": {
> "x": 1242,
> "y": -2940
> },
> "restore": {},
> "expect": [
> {
> "name": "value",
> "type": "text",
> "label": "Text"
> }
> ]
> }
> },
> {
> "id": 207,
> "module": "regexp:Parser",
> "version": 1,
> "parameters": {
> "pattern": "\\[(?<tag>[^\\]]+)]\\s*(?<content>[\\w\\W]+?)\\s*\\[\\/\\1]",
> "global": true,
> "sensitive": true,
> "multiline": false,
> "singleline": false,
> "continueWhenNoRes": false,
> "ignoreInfiniteLoopsWhenGlobal": false
> },
> "mapper": {
> "text": "{{206.value}}"
> },
> "metadata": {
> "designer": {
> "x": 1488,
> "y": -2940
> },
> "restore": {
> "parameters": {
> "sensitive": {
> "collapsed": true
> },
> "multiline": {
> "collapsed": true
> },
> "singleline": {
> "collapsed": true
> },
> "continueWhenNoRes": {
> "collapsed": true
> }
> }
> },
> "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
> },
> {
> "name": "ignoreInfiniteLoopsWhenGlobal",
> "type": "boolean",
> "label": "Ignore errors when there is an infinite search loop",
> "required": true
> }
> ],
> "expect": [
> {
> "name": "text",
> "type": "text",
> "label": "Text"
> }
> ],
> "interface": [
> {
> "type": "text",
> "name": "tag",
> "label": "tag"
> },
> {
> "type": "text",
> "name": "content",
> "label": "content"
> },
> {
> "type": "uinteger",
> "name": "i",
> "label": "i"
> },
> {
> "type": "any",
> "name": " __IMTMATCH__",
> "label": "Fallback Match"
> }
> ]
> }
> },
> {
> "id": 208,
> "module": "builtin:BasicAggregator",
> "version": 1,
> "parameters": {
> "feeder": 207
> },
> "mapper": {
> "tag": "{{207.tag}}",
> "content": "{{207.content}}"
> },
> "metadata": {
> "designer": {
> "x": 1731,
> "y": -2940
> },
> "restore": {
> "extra": {
> "feeder": {
> "label": "Text parser - Match pattern [207]"
> },
> "target": {
> "label": "Custom"
> }
> }
> }
> }
> },
> {
> "id": 209,
> "module": "util:SetVariable2",
> "version": 1,
> "parameters": {},
> "mapper": {
> "name": "variables",
> "scope": "roundtrip",
> "value": "{{toCollection(208.array; \"tag\"; \"content\")}}"
> },
> "metadata": {
> "designer": {
> "x": 1976,
> "y": -2941
> },
> "restore": {
> "expect": {
> "scope": {
> "label": "One cycle"
> }
> }
> },
> "expect": [
> {
> "name": "name",
> "type": "text",
> "label": "Variable name",
> "required": true
> },
> {
> "name": "scope",
> "type": "select",
> "label": "Variable lifetime",
> "required": true,
> "validate": {
> "enum": [
> "roundtrip",
> "execution"
> ]
> }
> },
> {
> "name": "value",
> "type": "any",
> "label": "Variable value"
> }
> ],
> "interface": [
> {
> "name": "variables",
> "label": "variables",
> "type": "any"
> }
> ]
> }
> }
> ]
> }
> ],
> "metadata": {
> "version": 1
> }
> }
> 
> ```

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

— @samliew

---

<div class="post-metadata">

**Author:** ![Jamiak](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@Jamiak](https://community.make.com/u/Jamiak)\
**Post date:** [August 9, 2024, 2:48am UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016/6 "2024-08-09T02:48:55Z")

</div>

Wow! Thank you soooo much!

I have another question in that same automation that is stumping me.

I want to then send these to Airtable and then straight to Wordpress. When I try to search for the tags and categories I sent through the parser and create a new one if one doesn’t already exist, Wordpress does not recognize it because it’s not a defined integer.

How would I send that over?

Thank you again!

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [August 9, 2024, 3:13am UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016/7 "2024-08-09T03:13:30Z")

</div>

No problem, glad I could help!

Please always start a new thread for your new question, as I am unsure if I can answer it.

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](https://community.make.com/t/make-community-the-ultimate-topic/11682) 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](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/5/d/5d9b26fbef0fd7385a34084f61cd5b9165786f42.png)

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

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

### Getting Started

- [Help Centre](https://www.make.com/en/help) | [Tutorials](https://www.make.com/en/help/tutorials.html) – Make “Manual”
- [Make Academy](https://academy.make.com) – Basics 101: Learn Make and get certified

### Help Centre Basics

- [Mapping](https://www.make.com/en/help/mapping/mapping) – What is mapping? What can I map?
- [Mapping with arrays](https://www.make.com/en/help/mapping/mapping-arrays) – How to map items in an array
- [Aggregate an array for mapping complex fields](https://www.make.com/en/help/tools/flow-control#customizing-the-output)
- [Tokens for `parseDate`](https://www.make.com/en/help/functions/tokens-for-date-time-parsing) | [Tokens for `formatDate`](https://www.make.com/en/help/functions/tokens-for-date-time-formatting)
- [HTTP modules](https://www.make.com/en/help/tools/http) – Make a request, Get (download) a file
- [Webhooks](https://www.make.com/en/help/tools/webhooks) – Error Handling, Responding to webhooks

### Articles & Videos

- [Router Magic Formula](https://www.youtube.com/watch?v=4Q-5BsCtJu4) - YouTube
- [Error Handlers in Make](https://www.youtube.com/playlist?list=PLRE9E-rAD8U10mx2TRs54Nq1XJDdK9Kx4) - YouTube playlist
- [Getting started with OpenAI](https://community.make.com/t/getting-started-with-openai-gpt-3-and-make/7796) - How to setup and use OpenAI (ChatGPT) in Make
- [How to use Regex in Make](https://community.make.com/t/how-to-use-regex-in-make/202) - How to use pattern matching to extract the text you want

### Partner & Custom Apps

- [Make Partner Training Portal](https://partnertraining.make.com)
- [Custom Apps / App Builder](https://docs.integromat.com/apps)

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

— @samliew

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [August 23, 2024, 1:49pm UTC](https://community.make.com/t/incorrectly-truncated-text-parsing/50016/8 "2024-08-23T13:49:05Z")

</div>


