RegEx Not Working - Trying to Keep Original Order as well as the Hyphenated Word
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Any help to clean my workflow up will be most greatly appreciated.
Solved! Go to Solution.
- Labels:
- Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
