Split text with multiple delimiters

Hello again guys,

Want to split a text from an array. It can be like that random :

  • {item1} / {item2}
  • {item1} and {item2}
  • {item1} , {item2}

I do that

But sometimes, split doesn’t work. the response remains similar to the input.

Formule is correct ? Or perhaps I should add each possible separator: “,” “/” or “and” in a separate module.

Regards,

You’ll need to use a “Match Pattern” module if you want multiple delimiters.

^(?<item1>.+)\s*(?:/|,|and)\s*(?<item2>.+)$

Output:

2 Likes

mhhhI have that

No, based on your first screenshot, you did not paste my pattern exactly. There is a duplicate end bit causing it to fail.

Plus, you should be selecting No for Global match.

08683c9bb7177a8259d7aecdf989689d7981fff9

2 Likes

Yes, because there can be more than one value, so I’ve adapted it like this :

^(?<item1>.+)\s*(?:/|,|and)\s*(?<item2>.+)\s*(?:/|,|and)\s*(?<item3>.+)\s*(?:/|,|and)\s*(?<item4>.+)\s*(?:/|,|and)\s*(?<item5>.+)\s*(?:/|,|and)\s*(?<item6>.+)$

Hi @hugo2,
I’d recommend you test your regular expressions before trying to use them in Make.
Use a site like regex101.com and select ECMAScript/JavaScript on the left side.
This site will also help you identify invalid patterns.

4 Likes

The pattern works exactly for the example you previously provided. You should be providing all the possible examples.

3 Likes