It is not counting if it has a comma- can this still be used? REGEX_CountMatches([Payee Name],'[A-Za-z]+\s[A-Za-z]+\s[A-Za-z]+\s+')
thanks
I edited it slightly. See attached.
As for why you got one...did you attempt to retype what was in the image, or did you download the Alteryx workflow and copy and paste directly from there? I suggest you do the latter, but in case you did the former, here is each expression for you to copy and paste.
Name Copy
Trim([Name])
REGEX_Replace(ReplaceChar([Name Copy], '. ,', '|'), '\|+', '|')
Count
IF IsEmpty([Name Copy])THEN 0ELSE REGEX_CountMatches([Name Copy], '\|') + 1ENDIF
This is to count 3 spaces in this column it works but only if no comma or period
how to fix this
Hey @hi2019 What you did so far with your WF and what is the challenge that you are facing, what you wrote is a very generic question. Please be more specific.
What I used for regex was to count 3 spaces within a field for payee name but I was testing it and I see it only counts spaces like JOHN SMITH JANN but if it is JOHN S. JANN or JANN, JOHN SMITH it doesnt read it as 3 spaces
I need to identify if it has 3 spaces
- can I use or update what I have now?
I see, in this post it is explained how to count specific character, you can use \s for space.https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Count-a-specific-characters-in-a-string/td-p/193933 Try and see if this works for you.
it doesnt specify for commas -
@hi2019 your given data has only 2 spaces
I need it to count 3 spaces and exclude the comma (not counting comma)
JOHN SMITH, JR
count 3
JR JOHN SMITH
APRIL MAY, SMITH
SMITH, MAY APRIL
@hi2019 the data "JR JOHN SMITH" has only two spaces, how are you counting 3 spaces?
After JR
After JOHN
After SMITH
or it doesnt count last one?
If there is a space at the end of each names then it will count
oh ok but can we exclude not counting commas?
the given regex only counts spaces, it doesn't count any other characters. \s+ counts only the spaces
Is this what you're looking for?
The attached example was made using Alteryx version 2021.4
hmm, when I tried it didnt work?
example JOANN TRANSPORTATION CANE
showed |JOANN|TRANSPORTATION|CANE|
count was 1?