Skip to content

Instantly share code, notes, and snippets.

@Elerphore
Created December 30, 2022 16:40
Show Gist options
  • Select an option

  • Save Elerphore/f3ea099bfa427fbf1bcad6daa2be3139 to your computer and use it in GitHub Desktop.

Select an option

Save Elerphore/f3ea099bfa427fbf1bcad6daa2be3139 to your computer and use it in GitHub Desktop.
Regex which should inline a string with only one capital letter with no numbers and digits.
^[а-я]*[А-Я]{1}[а-я]*$
@Elerphore
Copy link
Copy Markdown
Author

Testet in on: https://regex101.com

With this cases:

// SUCCESS
"Мама",
"авТо",
"гриБ",
'Яблоко', 'яБлоко', 'ябЛоко', 'яблОко', 'яблоКо', 'яблокО'

// FAILER
"агент007" - содержит цифры
"стриж" - только строчные буквы
"ГТО", - более одной заглавной буквы
"Три богатыря" - содержит пробел, допустимы только буквы

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment