Alteryx Designer Desktop Discussions

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

Regex Match Formula

SagarGite
7 - Meteor

There is a formula being applied on my data - REGEX_Match(ToString([INN]), "-?[0-9]+") the developer is no more with my company and i belive this formula highlits the records where there is any number in the field and i have a vleu - "THIAMINE (VITAMIN B1)" under this B1 there is 1 number available still it does not validated this formula which is correct for my need but i am not sure how this works?

4 REPLIES 4
sergejs_kutkovics
9 - Comet

Overall, the formula is checking whether the string representation of the value in the [INN] field contains a valid integer pattern. If there is a match, it will return true, indicating that the value is a valid integer; otherwise, it will return false.

  • -?: This part of the pattern allows for an optional minus sign at the beginning of the string, indicating a negative number.

  • [0-9]+: This part of the pattern matches one or more digits (0 to 9).

With the example value you provided, I'd say the ToString([INN]) part is not necessary, as the value provided is already a string. 

apathetichell
18 - Pollux

Your regex should match that value. I see it as unmatched in my designer - which is wrong. I edited this to:

REGEX_Match(ToString([INN]), ".*-*\d+.*")

 

which did correctly tag this value.

sergejs_kutkovics
9 - Comet

@SagarGite, the original formula will validate data only when the whole [INN] value looks like an integer. If you want to validate all [INN] that contains an integer, use the formula provided by @apathetichell.

apathetichell
18 - Pollux

@sergejs_kutkovics that was my initial take - but regex101 says otherwise...

Labels