Alteryx Designer Desktop Discussions

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

how to filter number and letters

luo
8 - Asteroid

Hi all,

 

I am trying to filter the value that contains number or letters. For example, if the value is 123abc or 123456 or abcdse then true. 

Can filter tool do that? 

6 REPLIES 6
atcodedog05
22 - Nova
22 - Nova

Hi @luo 

 

Sure you can, using regex_match in filter. Here REGEX_Match([Field1], "\w+") is checking whether its a number or letter. If its not a number or letter like "-" the it goes to false.

 

Input:

atcodedog05_1-1621415134659.png

 

Workflow:

atcodedog05_0-1621415116526.png

 

Here is a resource on RegEx https://community.alteryx.com/t5/Interactive-Lessons/Creating-Regular-Expressions/ta-p/441412#done

 

Hope this helps 🙂

afv2688
16 - Nebula
16 - Nebula

Hello @luo ,

 

here you can find an example on how to do it.

 

Regards

luo
8 - Asteroid

hi @atcodedog05 thank you for your information. sorry for the misunderstanding. I mean "and" not "or". Like must contain both numbers and letters. Thank you. 

atcodedog05
22 - Nova
22 - Nova

Hi @luo 

 

Here is the formula that will go in the filter

 

 

 

!REGEX_Match([Field1], "[[:alpha:]]+") AND
!REGEX_Match([Field1], "\d+") AND
!REGEX_Match([Field1], ".*\W.*")

 

 

 

1st line is checking that string is not only letter and

2nd line is checking that string is not only numbers and

3rd line is checking that no special characters

 

So this way the string will have both letters and numbers

 

Workflow:

atcodedog05_0-1621415889955.png

Hope this helps 🙂

Shifty
12 - Quasar

Nice solve, @atcodedog05.  I definitely need to get better at RegEx! 😁

GosiaK
7 - Meteor

Thanks @atcodedog05 for sharing these formulas, will make my life much easier.

Labels