Alteryx Designer Desktop Discussions

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

RegEx Not Working - Trying to Keep Original Order as well as the Hyphenated Word

JPSeagull
8 - Asteroid

Attached is a workflow that works almost as I need. My challenge was to list, in order, distinct values from three columns: "Services All Extracted," "Service Group All Extracted" and "Service Level All Extracted." With the attached workflow, I can get mostly what I need but I am losing second parts of a description that has hyphen or space and the other issue is that the order in the new columns are alphabetical instead of the original order.

 

I cannot figure out how to keep the second part of the hyphenated word or the space and the second part of a word. For example "Non-Core" is extracted as "Non" and "Other Service" is extracted as "Other." And not sure where I can keep the original order of each of the new column data. Our managers know that starting from the left and separated by commas the each item by order corresponds to the next two columns. For example original text input tool row 4, The Services of "CBC" is "Basic" of Service Group and "Core" of Service Level while "XYY" Is "Master" and "Non-Core," respectively.

 

 

JPSeagull_0-1666549897654.png

 Any help to clean my workflow up will be most greatly appreciated.

4 REPLIES 4
IraWatt
17 - Castor
17 - Castor

Hey @JPSeagull,

From what I understand from the problem and the workflow you will need to add a bit more to your Regex.

Currently you have:

([A-Z]+)

This matches one or more of any character's A to Z. To add in dashes and spaces your regex would look something like this:

([A-Z\-\s]+)

\- gets the dashes as \ escapes the special character -. The \s is the regex for spaces. Therefore, what the regex above says is capture anything which is A to Z, a dash or a space.

 

If you want to learn more about Regex the community has some really quick interactive videos on getting to grips with it here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Parsing%20...

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

apathetichell
18 - Pollux

REGEX.gif

 

Just pretend that says "REGEX" instead of Creamed Corn"...

binuacs
20 - Arcturus

@JPSeagull One way of doing this with the standard macro

 

binuacs_0-1666609766064.png

 

JPSeagull
8 - Asteroid

@IraWatt  - Thank you! I do need to carve out time and study RegEx more. I have a very basic understanding and something like this I need to just figure out. I appreciate your time.

Labels