Alteryx Designer Desktop Discussions

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

Insert space in string.

Aleksander_Gorski
7 - Meteor

Hello 

I have two columns with names where each record ends with some text in brackets. It looks like that "Paul Novak(ABC)" or "Paul Novak (BA)". 

I would like to remove to all statements in brackets from the string but there is some problem in replace function.

How can I write expression to get rid of it?

8 REPLIES 8
MarqueeCrew
20 - Arcturus
20 - Arcturus

@Aleksander_Gorski,

 

Here's a regular expression for you:

 

Regex_Replace([Field1],"(.*)\s*\(.*",'$1')

It will take everything until it hits the "last" open parenthesis.  Edited to include with or without a space.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Kenda
16 - Nebula
16 - Nebula

Hey @Aleksander_Gorski

 

The only thing I would add to @MarqueeCrew's wonderful solution would be to surround that function with the Trim function in case there are any trailing spaces left after the RegEx. 

trim(Regex_Replace([Field1],"(.*)\(.*",'$1'))
jasperlch
12 - Quasar

Hi, this can be achieved by using the Regex tool:

 

Capture1.PNG

Aleksander_Gorski
7 - Meteor

Thank you guys. I have also one question: how to make email from this output? Something like Paul.Novak@abc.com

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Aleksander_Gorski,

 

If a field always appears as "fname lname", there are many ways.

 

Replacechar([Field1]," ",'.') +"@abc.com"

 

That's just one way.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Aleksander_Gorski
7 - Meteor

Thanks, I have already made it with Regex_Replace. 

Aleksander_Gorski
7 - Meteor

Hello, that's me again.

What when I would like to create new columns from Paul Nowak?

Something like this:

Paul NovakPaulNovak

 

I was trying to made it with formula tool, name extraction is easy but I have problem with writing expression for surname. 

 

Sorry for this asking&asking but this is my first day with alteryx software in my work. 

ivoller
12 - Quasar

There are a few ways to do this in Alteryx. Note. a complete solution may need to look for cases beyond the straightforward "name surname" example. For instance, title, punctuated names, multiple middle names, JR, SR etc.

 

A starting point might be as below and attached.

 

2018-08-06_13-42-47.png

Labels