Alteryx Designer Desktop Discussions

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

RegEx to remove all non alphanumeric characters

jt_edin
8 - Asteroid

Could someone please show me how to use some simple RegEx to do the following please:

 

"String with spaces, punctuation; and numbers (22)" -> "Stringwithspacespunctuationandnumbers22"

 

The only characters I want to retain are letters a-z (case doesn't matter) and numbers 0 to 9. I'm working with web services that don't like punctuation, but I don't want to code string values with a generic recordID because I still want the results to be readable.

 

Basically, anything that isn't a to z or 0 to 9 can just be thrown away. I this easy to do? Thanks

4 REPLIES 4
Federica_FF
11 - Bolide

Regex tool

 

Method: replace

Pattern: \W

Replacement text: leave it blank

jt_edin
8 - Asteroid

Oh wow that was easy! I didn't even know there was a Regex tool, I thought I'd have to mess around with a function in a formula or filter. That makes life much easier! Thank you

AndréB
Alteryx Alumni (Retired)

Hi @jt_edin and others reading this thread who may not be familiar with RegEX, the "Data Cleansing" tool will accomplish the same thing too! Just check the "Punctuation" box under the "Remove Unwanted Characters" section.

 

-AndréB

pfiskrat
7 - Meteor

Data Cleansing tool does not accomplish the exact same thing in all cases. For this example - yes. But if there are some other special characters present it does not remove them. 

Labels