Alteryx Designer Desktop Discussions

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

Help Splitting Data

HongAlt
6 - Meteoroid

1.JPG

 

Hi There,

 

How would I split the data using the RegEx Function?

I need to split the header from the Body.

The start of the Body would be Where it says "Subject" 

 

Not very familiar with this function and not sure what is the correct regular expression to use to achieve this. Thank you 

14 REPLIES 14
DataNath
17 - Castor

Hey @HongAlt you should just be able to use the RegEx tool in parse mode with the following:

 

Subject:\s(.*)

 

This will capture everything after Subject:

 

You can also use regular string functions. Here's an example of both with a dummy string I quickly mashed out on the keyboard as you provided a screenshot:

 

Input string:

DataNath_0-1667338276681.png

 

String functions:

DataNath_0-1667372815037.png

 

RegEx:

DataNath_1-1667372830730.png

HongAlt
6 - Meteoroid

Hi Thank you for responding and providing such details on it. 

 

I attached a photo of what they want the output to be like.

 

The "Subject:\s(.*)" you showed was able to output just the email body.

 

If it is not too much trouble, what would be the expression to get the output shown in the picture. Thank you in advance 

Capture.JPG

grazitti_sapna
17 - Castor

@HongAlt , please use the below configuration to get your desired result. Sharing the updated workflow

 

grazitti_sapna_0-1667367955768.png

 

Sapna Gupta
DataNath
17 - Castor

Hi @HongAlt, no problem! I've edited my original post above and also uploaded the amended workflow which gets the outcome you're looking for - hope that helps!

 

As a note: The reason I provided the string functions as well is because it's generally best to avoid using RegEx if possible, due to it being a bit more computationally expensive. Thanks!

HongAlt
6 - Meteoroid

Thank you so much appreciate it, I was able to generate the results, with the addition of a non-greedy expression on the first part.  

DataNath
17 - Castor

Glad it worked @HongAlt! If you got the outcome you were after, feel free to mark helpful answers as a solution so that others with the same issue can easily find it in future! If you still need any help or pointers then please feel free to shout up!

HongAlt
6 - Meteoroid

Hi @DataNath,

 

Thank you so much for all your help with the problem. I was hoping I could bother you one more time for assistance as I am quite lost regarding the expression on RegEx. As you said other methods might be easier but they require us to use RegEx to generate the results. 

Email Header.JPGParsed.JPG

 

What expression would be used to parse the information to generate the results shown in the second photo? Thank you again

DataNath
17 - Castor

Hey @HongAlt are you able to attach a sample of the data, rather than a screenshot? Would be a lot easier to test/develop a solution with!

HongAlt
6 - Meteoroid

Here is the yxzp file, let me know if anything else is needed

Labels