Tip of the Day: Find non-ASCII Characters with Regex

Search for non-ascii characters using regex: [^\x00-\x7F]+

An example using Python:

import re

valid_ascii = "abcdef"
non_ascii = "ðñò"

re.search("[^\x00-\x7F]+", valid_ascii+non_ascii)
<re.Match object; span=(52, 55), match='ðñò'>
Nicholas Nadeau, Ph.D., P.Eng.
Nicholas Nadeau, Ph.D., P.Eng.
Project Director

Nicholas Nadeau is the project director at Halodi Robotics, leading their mission of bringing safe and capable humanoid robots to everyone.

Related