In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

How to filter out using regex

Sshasnk
8 - Asteroid

Hi I have a data set where I have to filter out all the records if the value is not Number or if the value does not contain '-'

 

Input:

Value
I-12345
23455
KLMABC
ABC6666
123
Pending

 

Now in the above, Only three of the above comes under our rules

Output:

 

Value
I-12345
23455
123

 

The above value is either number or contains '-'

3 REPLIES 3
MJLee
5 - Atom

@Sshasnk 

 

Please refer to the picture below and the attached WF.

 

Regex ::

A.jpg

 

 

 

 

 

 

 

 

 

Result ::

 

B.jpg

caltang
17 - Castor
17 - Castor

Perhaps you can try this REGEX:

^\d+$|-

Or if you’d like something more traditional, you could try an IF Statement too: 

 

IF (IsNumber([Value]) OR Contains([Value], '-'))

THEN “True”
ELSE “False”
ENDIF

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Qiu
21 - Polaris
21 - Polaris

@Sshasnk 
Just in case, we can use the Regex_match also in the flter tool as below.

0921-Sshasnk.png

Labels
Top Solution Authors