Alteryx Designer Desktop Discussions

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

regex extract

messi007
15 - Aurora
15 - Aurora

Dear comunity,

 

I have field like this:

 

abc xyz email@email.fr

abc email.emil@email.com

fre gyu fff emailemil@email.com

 

What i expect is this 

abc xyzemail@email.fr
abcemail.emil@email.com
fre gyu fffemailemil@email.com

 

I really appreciate your help 🙂

 

Regards

4 ANTWORTEN 4
atcodedog05
22 - Nova
22 - Nova

Hi @messi007  

 

Here is the config

(.*)\s([\w@\.]*)

atcodedog05_1-1605258258098.png

Output:

atcodedog05_0-1605258304629.png

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

 

PhilipMannering
16 - Nebula
16 - Nebula

Another solution

 

(.*) (.*)
atcodedog05
22 - Nova
22 - Nova

Hi @PhilipMannering 

 

Your approaches are mind blowing. But i dont understand how its working.

 

For the 3rd string

atcodedog05_0-1605260205818.png

why is not splitting as 

 

fre  | gyu fff email.emil@email.com

 

PhilipMannering
16 - Nebula
16 - Nebula

Hi @atcodedog05 

 

Thanks 🙂 One day I'll write a blog or two...

 

Regex is by default greedy. The expression finds a) the first match and b) the longest possible match. Also, it's the first (.*) that takes precedence over the second.

 

So (.*) will capture everything.

And (.*)\s will capture everything up until the last space.

And (.*)\s(.*) will capture everything up until the last space and after the last space.

 

To split as you describe, make the first expression non-greedy with a question mark,

(.*?) (.*)

 

Dunno if any of that makes sense?

Beschriftungen