const regex = /^[\p{Cyrillic}0-9\s-#$%^&\\]+$/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^[\\p{Cyrillic}0-9\\s-#$%^&\\\\]+$', 'gm')
const str = `1 Май
-
Май 25\\5
Ӑ ӑ
Ӓ ӓ
Ә ә
Ӛ ӛ
Ӕ ӕ
Б б
В в
Г г
Ґ ґ
Ѓ ѓ
Ғ ғ
Ӷ ӷ
Ҕ ҕ
Д д
Ђ ђ
Е е
Ѐ ѐ
Ё ё
Ӗ ӗ
Ҽ ҽ
Ҿ ҿ
Є є
Ж ж
Ӂ ӂ
Җ җ
Ӝ ӝ
З з
З́ з́
Ҙ ҙ
Ӟ ӟ
Ӡ ӡ
Ѕ ѕ
И и
Ѝ ѝ
Ӥ ӥ
Ӣ ӣ
І і
Ї ї
Ӏ ӏ
Й й
Ҋ ҋ
Ј ј
К к
Қ қ
Ҟ ҟ
Ҡ ҡ
Ӄ ӄ
Ҝ ҝ
Л л
Ӆ ӆ
Љ љ
М м
Ӎ ӎ
Н н
Ӊ ӊ
Ң ң
Ӈ ӈ
Ҥ ҥ
Њ њ
О о
Ӧ ӧ
Ө ө
Ӫ ӫ
Ҩ ҩ
П п
Ҧ ҧ
Р р
Ҏ ҏ
С с
С́ с́
Ҫ ҫ
Т т
Ҭ ҭ
Ћ ћ
Ќ ќ
У у
Ў ў
Ӳ ӳ
Ӱ ӱ
Ӯ ӯ
Ү ү
Ұ ұ
Ф ф
Х х
Ҳ ҳ
Һ һ
Ц ц
Ҵ ҵ
Ч ч
Ӵ ӵ
Ҷ ҷ
Ӌ ӌ
Ҹ ҹ
Џ џ
Ш ш
Щ щ
Ъ ъ
Ы ы
Ӹ ӹ
Ь ь
Ҍ ҍ
Э э
Ӭ ӭ
Ю ю
Я я
abcdefgh
012344`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions