Find invalid caraters

How do I find if there are those odd “?” caracters in my string? Is it possible to do it via regex or other way? (Text file attached to the post)

image
TestEncoding.txt (68 Bytes)
Thanks

Hi @William_Blech_Sister
Try this regex pattern

It will help to remove invalid charators

Hope it helps

Mark it as solution if you got it

Regards
Nived N

Happy Automation

2 Likes

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.IsMatch(text,"[^\x20-\x7E]")

This returns true if the text contains character code 0x80 or above.
If you can accept including linefeed, tab etc, the following will work.

System.Text.RegularExpressions.Regex.IsMatch(text,"[^\x01-\x7E]")

Regards,

1 Like