Alteryx Designer Desktop Discussions

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

Reg Ex Parsing Help

alex
11 - Bolide

I need a little help to split some data.  The data may or may not have 3 parts.  If there is a first part then it will be enclosed by parentheses.  Same with the 3rd part.  Each part may contain multiple words.  The components may or may not have numbers or punctuation.  See the example below/  Any suggestions?

 

RegExSplit.JPG

 

3 REPLIES 3
PhilipMannering
16 - Nebula
16 - Nebula

You could try using the regex tool with this expression,

 

(\(.*?\))?([^\(]*)(\(.*\))?

 

It's a little on the convoluted side though..

alex
11 - Bolide

Works on my test data.  I'll try it on the actual production data later today just to be sure there were no other issues I didn't catch.  What is the purpose of the ? at the end of the first and third marked groups?  I'm also not exactly sure what the middle group is saying.

PhilipMannering
16 - Nebula
16 - Nebula

The "?" can mean lots of different things in regular expressions depending on how you use it. When used directly after a set, character or group it means capture 0 or 1. So (\(.*\))? means capture everything inside brackets either 0 or 1 time. This is important because, as you stated, the bracketed data at the start or end may or may not be there.

Labels