String Manipulation: Add function regexCount or support for regEx in count funcitons


while working on giving support I noticed that a function to count the occurrence of a matching RegEx might be worth adding. Or, as an alternative, add the option to use RegEx in the count or CountChars (with word boundary flag) funcitons.

To add a bit of context. I am preparing an example workflow that illustrates how to count words in a string. Though, without RegEx, the existing options are rather blunt and limited. If one would like to have a more elaborate solution, you must split the string and use GroupBy or us the text processing nodes which I personally feel are difficult to work with.


Hi @mwiegand,

Having recently heard about the new “Expression” node that is currently in development, which among other (future) things will be a more modern replacement for String Manipulation and Math Formula, it sounds like now would be an ideal time for us all to put together our wish lists of such functions to help push the direction on that!

Always up for a String Manipulation challenge though… the best I’ve come up with on a “regex count” is this:

		regexReplace($column1$,"A[0][0-9]{2}" ,"¬" )

So given a pattern to find e.g. A[0][0-9]{2}, this will replace all occurrences of that pattern with a character I’m not expecting to find in the string “¬” and then use regex to replace every character in the resulting string that is not “¬” with "", and then return the length of the result, which should (if my theory is correct) be the count of occurrences of that regex pattern.

Presented with the string A090B100A2030A560A0ABB90A012A456
The count of occurrences A[0][0-9]{2} (i.e. A followed by 0 followed by 2 digits) is: 2

I’ll admit the function doesn’t exactly roll off the keyboard though :wink:

1 Like