How to use Filter node based on word count of an input field

Describe the question

I have an input with a field containing a string. I’m trying to understand how I can ignore those inputs (and terminate the flow) when the string field contains less than 30 words.

I’ve tried regex ^(?:\b\w+\b[\s\r\n]*){0,29}$ — made by chatgpt

Is there a better way to achieve this?

Thanks!

The most basic way to check the word count is

this is oversimplification of the verification though, words are not always separate by spaces, and numbers for instance are not words, but if this works for you - this works for you.

If node splits the text by spaces and if the length is > 30 goes into true branch, otherwise - into the false branch. if you do not add any other nodes to the false branch this will effectively terminate your workflow (unless there are other execution branches somewhere else in the workflow).

2 Likes

You are indeed a Top Supporter! Thank you so much, this works great for my usecase as the number doesn’t have to be exact anyway.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.