Non-ASCII Character
Match runs of non-ASCII characters (anything outside U+0000–U+007F).
Try it in RegexPro →Available in
JavaScript / ECMAScript code
const re = new RegExp("[^\\x00-\\x7F]+", "g");
const input = "Hello, café!";
const matches = [...input.matchAll(re)];
console.log(matches.map(m => m[0]));Uses `String.prototype.matchAll` for global iteration (Node 12+ / all modern browsers).
Python (re) code
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+.
Go (RE2) code
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`[^\x00-\x7F]+`)
input := `Hello, café!`
for _, match := range re.FindAllString(input, -1) {
fmt.Println(match)
}
}Uses `regexp.MustCompile` (panics on bad patterns at startup) and `FindAllString` for all matches.
Pattern
[^\x00-\x7F]+ (flags: g)Raw source: [^\x00-\x7F]+
How it works
Examples
Input
Hello, café!Matches
é
Input
naïve résumé 🎉Matches
ïéé🎉
Input
plain ascii hereNo match
—Common use cases
- •Auditing source code for non-ASCII identifiers
- •Encoding-bug detection in legacy data
- •Building i18n test cases
- •Migrating between charsets
Related patterns
Non-Capturing Group (Image URL)
Text ProcessingUse non-capturing groups `(?:...)` to alternate without polluting the captured-groups list.
Tab Character
Text ProcessingMatch literal tab characters — the regex behind every formatter / linter that yells about indentation.
Hashtag
Text ProcessingMatch hashtags (# followed by word characters) in social media posts, including accented Latin characters.
Lazy / Non-Greedy Quantifier
Text ProcessingDemonstrate lazy quantifiers `+?` by matching the SHORTEST HTML-like tag rather than the longest greedy span.