Alteryx designer Discussions

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

REGEX_Match tool to only find numbers

Highlighted
Alteryx Certified Partner

I am trying to see whether one of my fields has any alphabetical characters. I only want the field to have numbers. Do I use the Regex Match tool to solve this?

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

isNumber([Your_Text_Field])

 

will tell you (True/False) if it is a number.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Highlighted
Alteryx Certified Partner

Thank you!! However, some of the entries look like this "ABC92840" - with letters and numbers combined. Is there a way to find these values that have letters and number together so I can filter them out?

Alteryx Certified Partner
Alteryx Certified Partner
regex_match([Text],"[[:alpha:]]{1,}\d{1,}.*|\d{1,}[[:alpha:]]{1,}.*")

This might not be the prettiest version of a alpha+numeric check, but it worked for:

 

123ABC

ABC123

ABC123ABC

123ABC123

 

Evaluate as TRUE when Text contains

1 or more alpha characters followed by 1 or more digits followed by anything

or

1 or more digits followed by 1 or more alpha characters followed by anything

 

It won't find:

-123ABC

#ABC123

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Highlighted
8 - Asteroid

I have similar problem like i have some data where i want to have to find the fields which contain AB-1234567 and AB1234567 , the numbers can be anything from 0-9 but the format is as such as i mentioned , i tried regex match but its considering the entire filed if it matches only it is taking it but here i need to use contains any help?

Highlighted
Alteryx Partner

* Although the Question was posted long time ago, i am posting this solution to help those who are very new and can't get on hands with REGex for now.

 

You can use the following in a FORMULA tool  (create a new column)

IF length([FIELD NAME]) >  length(ToString(ToNumber([FIELD NAME]))) THEN "TRUE" else "FALSE" ENDIF

 

Now use FILTER on THIS COLUMN, TRUE will give you the dataset which contains mix of numbers and CHARS and FALSE will give you only numbers.

 

Highlighted
7 - Meteor

Yes You can . Suppose the name of Field is ''Count'. Represented below

 

Count

1

asv

3

err

hello

bye

34

 

using Filter too create a custom filter on the Count field with the following expression  --- ---- REGEX_Match([ Count], '^\d.*')

 

I will give us only numerical value -   1,3,34

 

 

Cheers 

Chhamanshu

Highlighted
8 - Asteroid

The above solution helped me but i have negative values that i want also to return in addition to all positive real number from the filter formula REGEX_Match([Count], '^\d.*'), how do i include it on the custom formula of the filter?

Thanks

Labels