Skip to main content
Solved

Handling special characters

  • March 21, 2025
  • 3 replies
  • 224 views

Forum|alt.badge.img+7

Hello all,

 

I have a feeling this is a long shot but thought i would ask none the less. We have a bot that reads in the contents of an email  which contains a list of information in the format <LABEL>: <VALUE>.

Unfortunately, sometimes there are hidden special characters after a value. If I were to manually highlight the value in the email i can tell there are special characters usually by the fact there is more than one space after the value. The bot reads in the value along with its special characters which then causes problems later on in the code. I don’t suppose there is any way to check for and weed out special characters in an email?

Best answer by madhu subbegowda

The possible hidden characters are due to nbsp values. To remove any hidden characters and replace with nothing and the additional.blank spaces pass the string and call this regex code. This should solve the problem: [\s\xA0]+ or [\xA0\s]+

 

\s will remove white or blank spaces and \xA0 will check for nbsp values and replaces with nothing.

3 replies

Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • March 21, 2025

Not at my computer, but maybe a regex that includes all standard ASCII characters and replaced everything outside those bounds with nothing.


madhu subbegowda
Most Valuable Pathfinder
Forum|alt.badge.img+12
  • Most Valuable Pathfinder
  • Answer
  • March 22, 2025

The possible hidden characters are due to nbsp values. To remove any hidden characters and replace with nothing and the additional.blank spaces pass the string and call this regex code. This should solve the problem: [\s\xA0]+ or [\xA0\s]+

 

\s will remove white or blank spaces and \xA0 will check for nbsp values and replaces with nothing.


Forum|alt.badge.img+2
  • Cadet | Tier 2
  • August 26, 2025

[^\x20-\x7E] did the trick for me. [\s\xA0]+ or [\xA0\s]+ did not function