Alteryx Designer Desktop Discussions

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

Lookbehind/lookahead function Regex in Formula tool

lledl
7 - Meteor

I have a list of email addresses but the data itself is dirty; there are dots,underscores etc appended to the end of email addresses. Example: 1-)alex@gmail.com___ 2-)alex@yahoo.co.uk... 3-)alex@hotmail.com----- 4-)alex@gmail.com  so what I would like to do is to use lookbehind/lookahead function and starting from the first alphanumeric character from the end point take left hand side as a group..In other words, alex@gmail.com___ becomes alex@gmail.com, alex@yahoo.co.uk... becomes alex@yahoo.co.uk

 

I was able to do it with other ways, but I'm specifically looking lookbehind/lookahead function with FORMULA module (or something else where I can read the field backwards and starting from the first alphanumeric value grouping left handside.

 

Thank you for your help

3 REPLIES 3
RodL
Alteryx Alumni (Retired)

Without commenting on any of the logic, just want to point out there is a ReverseString function in the Formula tool.

lledl
7 - Meteor

what i was looking for...thanks

jdunkerley79
ACE Emeritus
ACE Emeritus

If you would like to do with REGEX. I think:

REGEX_Replace([Field1], "(.+[[:alpha:]])([^[:alpha:]]*)", "$1")

will do what you need.

 

Matches up to last alpha character into $1 and non-alpha characters get removed.

Labels