Handling inner commas in Zapier's text formatting tools

I’m stuck with Zapier’s text formatting. I’m using the line item to text or split by comma tool. It works okay most of the time but it’s messing up when there are commas inside the text.

Here’s what I want:

Input: John Doe, III, Teacher

Output:
1: John Doe, III
2: Teacher

But I’m getting this instead:

Input: John Doe, III, Teacher

Output:
1: John Doe
2: III
3: Teacher

Any ideas how to fix this? I need it to treat commas inside names as part of the text, not as separators. Thanks for any help!

I’ve dealt with this exact problem before. The key is to use a custom delimiter in your input data that won’t appear in your text naturally. For my projects, I’ve found that using a double pipe (||) works well. So you’d format your input like this:

John Doe, III||Teacher

Then in Zapier, use the ‘Split Text’ action and set ‘||’ as your delimiter. This should give you the output you’re looking for:

1: John Doe, III
2: Teacher

If you can’t change the input format, you might need to use a Code step in Zapier to handle the splitting. It’s a bit more complex, but it gives you full control over how the text is processed.

I encountered a similar issue when working with Zapier’s text formatting tools. The problem lies in how Zapier interprets commas by default. To solve this, I found that using a different delimiter can be effective. Instead of relying on commas, you could modify your input data to use a unique separator that won’t appear in your text, like a pipe symbol (|) or a double semicolon (;;).

For example, you could format your input like this:
John Doe, III|Teacher

Then, use Zapier’s ‘Split Text’ action and specify the pipe as your delimiter. This should give you the desired output:
1: John Doe, III
2: Teacher

If you can’t change the input format, you might need to use a more advanced solution, such as a custom JavaScript code step in Zapier to handle the splitting logic. This would allow you to implement more complex rules for identifying where to split the text.

have u tried using regex in zapier? it can handle those pesky inner commas. somethin like /(.?),\s(?=[^,]+$)/ might work. it’ll match everything up to the last comma, treating the rest as a single item. give it a shot and lemme know if it helps!