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.
Founder / Fractional CTO

Nicholas Nadeau is a fractional CTO empowering startups with next-gen technology expertise, and a passion for driving corporate innovation. Stay informed on cutting-edge hard tech trends - subscribe to my newsletter. Ready to innovate? Discover my services and accelerate your growth.