Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

REGEX_MATCH Help

MNewt9
7 - Meteor

Hello,

 

I've successfully used REGEX_MATCH to determine if a column has any combination of Alpha-Numeric values (i.e. N4334ABC, ABC4DRS, etc.).  However, I've got some additional characters to account for, including "-" (i.e. MO  Does anyone know how I can incorporate that?  Here is an example of what I have to this point:

 

IF [Unit]="PIE" AND REGEX_Match([SHPM_DESC], "[a-zA-Z0-9]+") AND
!REGEX_Match([SHPM_DESC], "[0-9]+") OR [Unit]="PIE" AND REGEX_Match([SHPM_DESC], "[a-zA-Z.0-9]+") AND
!REGEX_Match([SHPM_DESC], "[0-9]+") OR [Unit]="PIE" AND REGEX_Match([SHPM_DESC], "[a-zA-Z-0-9]+") AND
!REGEX_Match([SHPM_DESC], "[0-9]+")  THEN "PROMO" ELSE Null() ENDIF

 

Thanks in advance

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

@MNewt9 

 

REGEX_Match([SHPM_DESC], "[\w\-]+")

 

\w  matches any word character (equal to [a-zA-Z0-9_]) 
\- matches the - (dash) character.
 
If you don't want _ (underscore),
 
use:  [a-zA-Z0-9\-]
 
Cheers,
 
Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
MNewt9
7 - Meteor

Hello Mark,

 

I'm still struggling.  The learning curve for this function is definitely greater than others I've used.  I've been able to get a portion to work, but not in it's entirety.

 

Rule is anything that contains a-z AND 0-9 in any combination of characters must be put on "HOLD" in my new column creation.  Special characters like a hyphen, period, and even a blank space are allowed.

Any row that does not contain at least one alpha and one numeric character in the string is to remain null.

 

The formula below works for everthing in my data set except for the following two [SHPM_DESC]

NOW CBS NEW7-1

NOW ACS NEW9-3

 

IF [Unit]="PIE" AND REGEX_Match([SHPM_DESC], "[a-zA-Z0-9]+") AND
!REGEX_Match([SHPM_DESC], "[0-9]+") OR [Unit]="PIE" AND REGEX_Match([SHPM_DESC], "[a-zA-Z.0-9]+") AND
!REGEX_Match([SHPM_DESC], "[0-9]+") THEN "HOLD" ELSE Null() ENDIF

 

I am able to get them to populate in my test column when I use the following

 

IF [Unit]="PIE" AND REGEX_Match([SHPM_DESC],"[a-zA-Z]+"+"[\ ]+"+"[a-zA-Z]+"+"[\ ]"+"[a-zA-Z0-9]+"+"[\-]+"+"[0-9]+") AND !REGEX_Match([SHPM_DESC], "[0-9]+") THEN "HOLD" ELSE Null() ENDIF

 

However, if I combine the two formulas with an OR statement only the one directly above populates the 2 rows as "HOLD", the balance of alpha-numeric [SHPM_DESC] remain blank for some reason.

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@MNewt9 (Mike),

 

Please try this;

 

REGEX_Match([SHPM_DESC], "[\w\-\s]+")
AND !REGEX_Match([SHPM_DESC], "\d+")
AND !REGEX_Match([SHPM_DESC], "\u+")

 

Cheers,

 

Mark 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels