Non-ASCII Character in PY
Match runs of non-ASCII characters (anything outside U+0000–U+007F).
Try it in the PY tester →Pattern
regexPY
[^\x00-\x7F]+ (flags: g)Python (re) code
pyPython
import re
pattern = re.compile(r"[^\x00-\x7F]+")
input_text = "Hello, café!"
for m in pattern.finditer(input_text):
print(m.group(0))Stdlib `re` module — no third-party dependency. Works on Python 3.6+.
How the pattern works
[^\x00-\x7F] is a negated character class: anything NOT in the ASCII range 0x00–0x7F. The trailing + groups consecutive non-ASCII characters into a single match (so `café` matches as `é`, `naïve` as `ï`, etc.). Useful for finding accented characters, emoji, CJK, and other Unicode in otherwise-ASCII source.
Examples
Input
Hello, café!Matches
é
Input
naïve résumé 🎉Matches
ïéé🎉
Input
plain ascii hereNo match
—