2
July
2026
11:09

How to find characters in text that do not correspond to the written language

2 July 2026 11:09

The text may contain characters that are similar in appearance, but do not correspond to the language in which it is written.

For example, Russian "C" is similar to Latin "c", Russian "Х" is similar to Latin "x".
In appearance, POCOMAXA looks like a Russian word, but consists only of Latin letters.
The following Linux commands will help you find such inconsistencies.

Search for Russian letters in English text

First option search for Russian letters in English text:

This query will find letters that fall outside the 26 letters of the English alphabet from A to Z:

sudo apt install pcregrep
pcregrep --color='auto' -n "[^[:ascii:]]" eng.txt

In this option, words with symbols of national languages will be found.
For example: â (circumflex), é (acute), ü (umlaut).

Second option searching for Russian letters in an English test

grep --color='auto' -n -P '[\x{0410}-\x{044f}]' eng.txt

Search for English letters in Russian text

First option search for English letters in Russian text:

This query will find line numbers and highlight words with symbols of the 26 letters of the English alphabet A-Z:

sudo apt install pcregrep
pcregrep --color='auto' -n "[[:ascii:]]" rus.txt

Second option search for English words with letters A-Z in Russian text:

grep --color='auto' -n -P -v '[\x{0410}-\x{044f}]' rus.txt

Application: test files rus.txt and eng.txt in the archive test.zip.



Related publications