Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Elegantly remove all ASCII characters outside the range 32 -126

jhollingsworth
7 - Meteor
Hello Artisans,

I'm working on a module that includes a geocoder tool. I'm running into an issue in which the data the users are submitting to the module are copied from a web page and sometimes include weird characters (e.g. ASCII 160). This causes the geocoder problems. And by problems, I mean that the geocoder can only find the zip code when without the odd characters, it can find the address.

What I'm looking for is the most elegant way to remove any characters from a text value that fall outside of the ASCII range of 32 -126. Any characters inside that range *shouldn't* cause the geocoder problems.

Extra cool points to anyone from Alteryx that will fix incorporate this fix into the Address tool. :-)

Cheers,

John Hollingsworth
13 REPLIES 13
BrettMRP
5 - Atom

@Jordken Change the expression to read as follows:

 

regex_replace([_CurrentField_],"[^\xA,\xD,\x20-\x7e]+",'')

 

[_CurrentField_] being whatever your field name is if you are using the formula tool and not the multi field tool

MarqueeCrew
20 - Arcturus
20 - Arcturus
[ -~]

That's the range as elegantly as possible.

Cheers,
Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
SideOfRanch
8 - Asteroid

Is there a way to do this but return if the field had one of the untranslatable characters? I'm trying to identify them the fields and flag them with a 1 if they have a bad character.

MarqueeCrew
20 - Arcturus
20 - Arcturus

MIN(Regex_Countmatches([Garbage Data],"^[ -~]"),1)

 

 

That might help.

Alteryx ACE & Top Community Contributor

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