community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Filter out Values with multiple Dashes

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!

Pulsar

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

Aurora

Hi @Chirag_Gandhi07 

 

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

 

Solution.png

 

Dan

Highlighted
Pulsar

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.

@EstherB47 @danilang Thank you both!!

@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.

Aurora

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  

@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