Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Regex

aparna0208
8 - Asteroid

Hi,

 

I have a zipcode field in a dataset and which might not include digits and have state codes. I need to check to see if it contains numbers or not and filter out the records that doesn't contain digits. I tried regex but didn't get the expected output and getting some data type mismatch error. Looking for some help. Thanks in advance!

6 REPLIES 6
dsandmann
8 - Asteroid

REGEX_Match([Field], '[0-9]{5}')

 

That formula will check to see if there are 5 digits in a row within a the field, you can use it inside a filter tool. Without more details around your data examples it will be challenging to diagnose further.

aparna0208
8 - Asteroid

@dsandmann Thanks for the inputs. I already tried this and also the same formula with 'd' instead of 0-9 but the problem is I'm getting data type error "tried to apply string operator to numeric value" even after using select tool to change data type to double

crofootc
5 - Atom

So regular expressions is functioning with assumption that it is a string data type not a number. The fact that you changed it to a double is causing that error and it is telling you it cannot run a regular expression on a double

 

In addition I find the following website very helpful when testing out different regular expressions:

https://regex101.com/

BRRLL99
11 - Bolide

Hi

Do you have any sample input with expected output.

for Regex formula to work we need to understand the logic for the data

binuacs
21 - Polaris

@aparna0208 Let me know if the below filter condition works for you

binuacs_0-1684838888051.png

 

aparna0208
8 - Asteroid

@binuacs Got busy with something and got back on this today and it worked:) Thank you so much!

Labels
Top Solution Authors