Alteryx Designer Desktop Discussions

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

Filter out Values with multiple Dashes

Chirag_Gandhi07
8 - Asteroid

Hey everyone,

 

I have a field with values that contain one dash and some values contain multiple dashes. For example:

 

Name

James - Smith

Ryan - Jones

Dylan_ James - English - Burke

Elizabeth - kelly - Steve

 

How can I filter out the values that have multiple dashes? Any help would be greatly appreciated. Thank you!

7 REPLIES 7
estherb47
15 - Aurora
15 - Aurora

Hi @Chirag_Gandhi07 ,

 

You could use a filter, with a Custom filter based on counting the number of hyphens. The REGEX_CountMatches function can count the number of hyphens. Those rows that have more than one will flow through the T output and those with only one through the F output in the below exampleimage.png

 

Cheers!

Esther

danilang
19 - Altair
19 - Altair

Hi @Chirag_Gandhi07 

 

You can use REGEX_CountMatches in a formula tool and then filter on the result

 

Solution.png

 

Dan

estherb47
15 - Aurora
15 - Aurora

Great minds think alike, @danilang !!

 

You can either step out into two tools, using a formula and filter, or put the formula directly into the filter.

Chirag_Gandhi07
8 - Asteroid

@estherb47 @danilang Thank you both!!

Chirag_Gandhi07
8 - Asteroid

@estherb47 @danilang For the values with multiple dashes, do either of you know how I could filter out values based on the name after the last dash of the value? For example:

John - James - Smith

 

I would like to filter out the names that end in Smith. Now some of the values could have Smith as middle name. I only want to filter out the values that have Smith as a last name.

danilang
19 - Altair
19 - Altair

hi @Chirag_Gandhi07 

 

Add in a filter with the following config

 

Smith.png  

".*" matches any number of character and "Smith$" matches "Smith" but only at the end of a line(The "$" modifier).

 

Dan  

Chirag_Gandhi07
8 - Asteroid

@danilang Thank you. One last question, I want to split the values into to columns. For example:

John - James - Smith

 

I would like to split it up to two fields:

 

John - James

 and

- Smith

 

Thanks again. Really appreciate the help! Not really familiar with REGEX

Labels