Solved! Go to Solution.
I am definately in need of some extra cool points, so here is my most elegant way to remove ASCII characters outside of the range of 32-126. I was able to remove the undesired characters using RegEx (you can use the RegEx tool or the Formula tool for this) using the following expression:
Everything within the brackets represents a specific set of characters to match. The x switch matches an ASCII charater using hexidecimal representation. x20-x7e translates to ASCII characters 32-126. The ^ preceeding the range indicates that we want to match anything NOT in the specified range. The + outside the brackets indicates that we want to search for this pattern in our string 1 or more times.
Using the RegEx tool:
Using the Formula tool:
Let me know if you have any questions.
Todd Williamson
Client Services Rep
Cool Points: 7
Todd,
I'm a little late with this...
I've been searching for an answer and your solution worked great! Thank you for the detailed post and for following up with a more elegant solution to your initial response.
sd
Don't forget the backslashes in the expression, which are shown in the graphic of the RegEx box but not in the accompanying text. [^\x20-\x7e]+
You Sir, are a star.
I like your expression (having used it myself), but wanted to describe the request in English and to offer @jhollingsworth an alternative solution.
This expression can be written in a form that more closely matches these requirements as:
REGEX_Replace([Field1], "[^ -~]", '$1')
[...] is the set of values
[^..] is then, the values not in the set
[^ -~] uses (space) followed by a dash followed by a tilde is then, the values not in the range of (space) to ~ (tilde)
Cheers,
Mark
This worked great for the most part: [^ -~]
However, I think I want to keep the carriage returns (13) and new line (10) characters as well. I'm still trying to figure this regex out, and I'm not getting it. Any help?