Alteryx Designer Desktop Discussions

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

Replace punctuation

wonka1234
10 - Fireball

Hi,

 

I have this line in python I want to do in alteryx:

df['Name'].str.replace('\W', ' ')

 

So i believe this line is not only "=" is replaced but any non-word character, e.g. "%","&","§","/",...

 

How do I create this in alteryx?

 

I am trying this formula "Replace([Name],'\W', ' ')" but I think this literally looks for \W.

 

Any help would be appreciated.

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

@wonka1234 ,

 

The expression that you're looking for (not the drones) is:

 

Regex_Replace([Name],"\W",'')

 

Check out more RegEx help by pressing F1 (from Designer).

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
wonka1234
10 - Fireball

@MarqueeCrew 

Thanks for this. 

 

Regex_Replace([Name],"\W",' ')

 I added an extra space in the ' '

 

 but how can I alter this for two punctuations in a string?

 

ie "alteryx=cool - community" to alteryx cool community .  Except its creating 2 spaces between cool and community.

But i still want the formula to count for "alteryx=cool" to alteryx cool.

 

Do you have something to incorporate both of those scenarios?

MarqueeCrew
20 - Arcturus
20 - Arcturus

You can look at the RegEx docs, but a space is:   \s  and 1 or more spaces is \s+

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels