Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

REGEX w comma

hi2019
8 - Asteroid

  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

15 REPLIES 15
binuacs
21 - Polaris

If there is a space at the end of each names then it will count

image.png

hi2019
8 - Asteroid

oh ok but can we exclude not counting commas?

binuacs
21 - Polaris

the given regex only counts spaces, it doesn't count any other characters. \s+ counts only the spaces

jbichachi003
9 - Comet

Is this what you're looking for?

 

The attached example was made using Alteryx version 2021.4

 

Alteryx.png

hi2019
8 - Asteroid

hmm, when I tried it didnt work?

 

example  JOANN TRANSPORTATION CANE

 

showed |JOANN|TRANSPORTATION|CANE|

 

count was 1?

jbichachi003
9 - Comet

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])

 

Name Copy

REGEX_Replace(ReplaceChar([Name Copy], '. ,', '|'), '\|+', '|')

 

Count

IF IsEmpty([Name Copy])
THEN 0
ELSE REGEX_CountMatches([Name Copy], '\|') + 1
ENDIF

 

Alteryx.png

Labels
Top Solution Authors