Alteryx Designer Desktop Discussions

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

Reg Ex Matching

Kbr34934
5 - Atom

I'm trying to use the reg ex tool to return matches for a pattern within an email. I've already parsed the emails out so that I'm only searching in the email body. I need to see if there is a username within the email. Some of the emails contain the phrase "username:" followed by the corresponding username. There is no pattern to where the phrase is located within the email body, so I'm not sure how to search the email body for that phrase. I just want the match to return whether or not the email body contains this phrase. Any help would be appreciated! Thanks

3 REPLIES 3
DataNath
17 - Castor

Hey @Kbr34934, do you need to return the actual match, or just flag whether or not 'username:' is present? From your post it sounds like the latter and if so, you could just use a regular Contains() statement with:

 

Contains([FieldName],'username:')

 

Where you just replace FieldName with the email body field you're checking. This will return a 0 or -1 as a true or false boolean response - if you want actual custom flags then you'll have to build an if statement around it like:

 

IF Contains([FieldName],'username:') THEN 'Present' ELSE 'Not present' ENDIF

 

Again, changing FieldName to your own and you can obviously make 'Present'/'Not present' to whatever you like.

flying008
14 - Magnetar

Hi, @Kbr34934 

 

Because your actual username is not fixed, it is recommended that you upload the sample data for parse test. I estimate that most of them should be processed in regular expressions. BTW, Does your username contain numbers and dots?

 

录制_2022_10_10_09_10_42_22.gif

grazitti_sapna
17 - Castor

@Kbr34934 You can try using contains function using formula tool as below for searching for particular text. And if you need a solution for some particular use case. Would suggest you to provide a sample input and output so that we can give you a proper solution based on your need.

 

grazitti_sapna_0-1665385369111.png

 

Sapna Gupta
Labels