We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Simple Regex Ignores Capitlization Requirement

hellyars
13 - Pulsar

 

I need to parse the field Text.

But I only want to parse those rows in text that meet a certain pattern.

The target rows will always contain all caps.

 

The target row has two groups I wish to pasre.

 

  1. Out_1 (group 1)  is an identifier that is 3-4 digits long.  99 out of a 100 it starts with a \d.  99 out of a 100 it will include both numbers and letters.  BUT, it can sometimes only be letters.
  2. Out_2 (group 2) is the name of the item.   It will always be in all caps.  But it can contain punctuation and special characters (-, &, () etc.)

 

Using the Regex Parse tool i tried the following expression:

 

 

^([A-Z0-9]{3,4})\s([A-Z\s&-]*[A-Z])$

 

 

 

>>>> This works 99.9% of the time.  BUT in the case where Text = "food insecurity" the above expression ignores the capitalization requirement and returns "food" in Out_1 and "insecurity" in Out_2.   This is not what I want.  What am I doing wrong?

 

 

Desired Outcome....

 

TextOut_1Out_2
1A2Y TACO - CRUNCHY1A2YTACO - CRUNCHY
2500  
Unjustified growth  
BSIM  TRAINING OPSBSIMTRAINING OPS
food insecurity  
111 FIELD OPS111

FIELD OPS

 

465464 

 

2 REPLIES 2
apathetichell
20 - Arcturus

There's an optional field you can throw into the regex functions which checks for case - otherwise it ignores it. See - https://help.alteryx.com/current/en/designer/functions/string-functions.html#idm45439286134896 (icase)

hellyars
13 - Pulsar

@apathetichell   I always forget about that preset.  Why does it even exist

Labels
Top Solution Authors