Last active
August 7, 2022 21:28
-
-
Save Elorucov/2cc278d8e154cc49f4f873baca44c4b8 to your computer and use it in GitHub Desktop.
Detect Z and V letters in cyrillic words.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ELOR 2022. | |
| using System; | |
| using System.Text.RegularExpressions; | |
| public class Program { | |
| public static void Main() { | |
| Console.WriteLine($"Result: {CheckIsBrainwashed("Залупа Zа Vойну! Хи-хи.")}"); | |
| } | |
| static readonly Regex Reg1 = new Regex(@"^[А-яЁёZzVv\d\W]+$"); | |
| static readonly Regex Reg2 = new Regex(@"^[А-яЁё\d\W]+$"); | |
| private static bool CheckIsBrainwashed(string str) { | |
| string[] words = str.Split(' '); | |
| bool detected = false; | |
| for (int i = 0; i < words.Length; i++) { | |
| string word = words[i]; | |
| bool m1 = Reg1.IsMatch(word); | |
| bool m2 = Reg2.IsMatch(word); | |
| Console.WriteLine($"{i}: {word} ({m1}/{m2})"); | |
| if (m1 && !m2) { | |
| detected = true; | |
| break; | |
| } | |
| } | |
| return detected; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
о спасибо тебе великий за этот замечательный гист, ведь ни один человек не осилил бы создать регулярки и проверять их 🙏🙏🙏🙏